Add code to emulate firmware/bootloader mode reporting via "general_status" field on RDU2. This is needed to correctly report if RAVE SP is in bootloader of application mode during startup. Signed-off-by: Andrey Smirnov <andrew.smirnov@xxxxxxxxx> --- drivers/mfd/rave-sp.c | 18 ++++++++++++++++-- include/linux/mfd/rave-sp.h | 1 + 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/mfd/rave-sp.c b/drivers/mfd/rave-sp.c index 1448c4143f..67f7d4c654 100644 --- a/drivers/mfd/rave-sp.c +++ b/drivers/mfd/rave-sp.c @@ -640,6 +640,7 @@ static int rave_sp_emulated_get_status(struct rave_sp *sp, [0] = RAVE_SP_CMD_GET_FIRMWARE_VERSION, [1] = 0, }; + u8 firmware_mode; int ret; ret = rave_sp_exec(sp, cmd, sizeof(cmd), &status->firmware_version, @@ -648,8 +649,21 @@ static int rave_sp_emulated_get_status(struct rave_sp *sp, return ret; cmd[0] = RAVE_SP_CMD_GET_BOOTLOADER_VERSION; - return rave_sp_exec(sp, cmd, sizeof(cmd), &status->bootloader_version, - sizeof(status->bootloader_version)); + ret = rave_sp_exec(sp, cmd, sizeof(cmd), &status->bootloader_version, + sizeof(status->bootloader_version)); + if (ret) + return ret; + + cmd[0] = RAVE_SP_CMD_GET_OPERATIONAL_MODE; + ret = rave_sp_exec(sp, cmd, sizeof(cmd), &firmware_mode, + sizeof(firmware_mode)); + if (ret) + return ret; + + status->general_status = + firmware_mode ? RAVE_SP_STATUS_GS_FIRMWARE_MODE : 0; + + return 0; } static int rave_sp_get_status(struct rave_sp *sp) diff --git a/include/linux/mfd/rave-sp.h b/include/linux/mfd/rave-sp.h index 7b3187cb74..92315c6e12 100644 --- a/include/linux/mfd/rave-sp.h +++ b/include/linux/mfd/rave-sp.h @@ -14,6 +14,7 @@ enum rave_sp_command { RAVE_SP_CMD_GET_FIRMWARE_VERSION = 0x20, RAVE_SP_CMD_GET_BOOTLOADER_VERSION = 0x21, + RAVE_SP_CMD_GET_OPERATIONAL_MODE = 0x25, RAVE_SP_CMD_BOOT_SOURCE = 0x26, RAVE_SP_CMD_GET_BOARD_COPPER_REV = 0x2B, RAVE_SP_CMD_GET_GPIO_STATE = 0x2F, -- 2.21.0 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox