summaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorAndrey Smirnov <andrew.smirnov@gmail.com>2019-09-07 16:59:30 -0700
committerSascha Hauer <s.hauer@pengutronix.de>2019-09-09 10:45:57 +0200
commite9352093ceb8ca6867d9ff543711743b36ea9112 (patch)
tree662e88f557ac4a20c98addc8475cd94e9bb7acfd /drivers/mfd
parentaa329e50ac45ecdcd73973b5a5e27f9eaf3a7fb3 (diff)
downloadbarebox-e9352093ceb8ca6867d9ff543711743b36ea9112.tar.gz
barebox-e9352093ceb8ca6867d9ff543711743b36ea9112.tar.xz
mfd: rave-sp: Emulate firmware/bootloader mode reporting on RDU2
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@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/rave-sp.c18
1 files changed, 16 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)