From: Andrey Smirnov <andrew.smirnov@gmail.com>
To: barebox@lists.infradead.org
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
Subject: [PATCH] mfd: rave-sp: Emulate firmware/bootloader mode reporting on RDU2
Date: Sat, 7 Sep 2019 16:59:30 -0700 [thread overview]
Message-ID: <20190907235930.24553-1-andrew.smirnov@gmail.com> (raw)
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>
---
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@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2019-09-07 23:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-07 23:59 Andrey Smirnov [this message]
2019-09-09 8:46 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190907235930.24553-1-andrew.smirnov@gmail.com \
--to=andrew.smirnov@gmail.com \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox