From: Lucas Stach <dev@lynxeye.de>
To: barebox@lists.infradead.org
Subject: [PATCH 1/2] ARM: imx6: gw54xx: add function to retrieve board revision from GSC
Date: Mon, 29 May 2017 22:02:41 +0200 [thread overview]
Message-ID: <20170529200242.17934-1-dev@lynxeye.de> (raw)
This parses the board revision from the GSC EEPROm model string.
Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
arch/arm/boards/gateworks-ventana/gsc.c | 14 ++++++++++++++
arch/arm/boards/gateworks-ventana/gsc.h | 2 ++
2 files changed, 16 insertions(+)
diff --git a/arch/arm/boards/gateworks-ventana/gsc.c b/arch/arm/boards/gateworks-ventana/gsc.c
index 3614230..92244d1 100644
--- a/arch/arm/boards/gateworks-ventana/gsc.c
+++ b/arch/arm/boards/gateworks-ventana/gsc.c
@@ -65,3 +65,17 @@ int gsc_i2c_write(struct i2c_client *client, u32 addr, const u8 *buf, u16 count)
return ret;
}
+
+char gsc_get_rev(struct i2c_client *client)
+{
+ int i;
+ u8 model[16];
+
+ gsc_i2c_read(client, 0x30, model, 16);
+ for (i = sizeof(model) - 1; i > 0; i--) {
+ if (model[i] >= 'A')
+ return model[i];
+ }
+
+ return 'A';
+}
diff --git a/arch/arm/boards/gateworks-ventana/gsc.h b/arch/arm/boards/gateworks-ventana/gsc.h
index a6e7e22..13f2262 100644
--- a/arch/arm/boards/gateworks-ventana/gsc.h
+++ b/arch/arm/boards/gateworks-ventana/gsc.h
@@ -56,3 +56,5 @@
*/
int gsc_i2c_read(struct i2c_client *client, u32 addr, u8 *buf, u16 count);
int gsc_i2c_write(struct i2c_client *client, u32 addr, const u8 *buf, u16 count);
+
+char gsc_get_rev(struct i2c_client *client);
--
2.9.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2017-05-29 20:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-29 20:02 Lucas Stach [this message]
2017-05-29 20:02 ` [PATCH 2/2] ARM: imx6: gw54xx: fixup watchdog nodes on pre rev E boards Lucas Stach
2017-06-01 6:21 ` [PATCH 1/2] ARM: imx6: gw54xx: add function to retrieve board revision from GSC 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=20170529200242.17934-1-dev@lynxeye.de \
--to=dev@lynxeye.de \
--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