mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Andrey Smirnov <andrew.smirnov@gmail.com>
To: barebox@lists.infradead.org
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
Subject: [PATCH v2 2/2] mfd: rave-sp: Add temporary workaround for missing GET_STATUS
Date: Wed,  2 May 2018 12:28:45 -0700	[thread overview]
Message-ID: <20180502192845.12483-3-andrew.smirnov@gmail.com> (raw)
In-Reply-To: <20180502192845.12483-1-andrew.smirnov@gmail.com>

---
 drivers/mfd/rave-sp.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/rave-sp.c b/drivers/mfd/rave-sp.c
index d55e913ff..6c24c28fc 100644
--- a/drivers/mfd/rave-sp.c
+++ b/drivers/mfd/rave-sp.c
@@ -635,8 +635,21 @@ static int rave_sp_get_status(struct rave_sp *sp)
 	int ret;
 
 	ret = rave_sp_exec(sp, cmd, sizeof(cmd), &status, sizeof(status));
-	if (ret)
-		return ret;
+	if (ret) {
+		cmd[0] = RAVE_SP_CMD_GET_FIRMWARE_VERSION;
+		ret = rave_sp_exec(sp, cmd, sizeof(cmd), &status.firmware_version,
+				   sizeof(status.firmware_version));
+		if (ret)
+			return ret;
+
+		cmd[0] = RAVE_SP_CMD_GET_BOOTLOADER_VERSION;
+		ret = rave_sp_exec(sp, cmd, sizeof(cmd), &status.bootloader_version,
+				   sizeof(status.bootloader_version));
+		if (ret)
+			return ret;
+
+		goto populate_version;
+	}
 
 	if (status.general_status & RAVE_SP_STATUS_GS_FIRMWARE_MODE)
 		mode = "Application";
@@ -645,6 +658,7 @@ static int rave_sp_get_status(struct rave_sp *sp)
 
 	dev_info(dev, "Device is in %s mode\n", mode);
 
+populate_version:
 	sp->part_number_firmware   = devm_rave_sp_version(dev,
 						   &status.firmware_version);
 	sp->part_number_bootloader = devm_rave_sp_version(dev,
-- 
2.14.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2018-05-02 19:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-02 19:28 [PATCH v2 0/2] Initial RAVE SP Linux driver port Andrey Smirnov
2018-05-02 19:28 ` [PATCH v2 1/2] watchdog: Port RAVE SP watchdog driver from Linux kernel Andrey Smirnov
2018-05-02 19:28 ` Andrey Smirnov [this message]
2018-05-02 19:31 ` [PATCH v2 0/2] Initial RAVE SP Linux driver port Andrey Smirnov

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=20180502192845.12483-3-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