From: Lucas Stach <l.stach@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH] ARM: rdu2: program e1000 iNVM
Date: Wed, 20 Jun 2018 11:51:12 +0200 [thread overview]
Message-ID: <20180620095112.14944-1-l.stach@pengutronix.de> (raw)
Check if the iNVM is already correctly written. If it isn't write
the correct value in, so the device uses the correct PCI ID for the
Linux driver.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
arch/arm/boards/zii-imx6q-rdu2/board.c | 29 ++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/arch/arm/boards/zii-imx6q-rdu2/board.c b/arch/arm/boards/zii-imx6q-rdu2/board.c
index 265f97e2f464..984ca42a3772 100644
--- a/arch/arm/boards/zii-imx6q-rdu2/board.c
+++ b/arch/arm/boards/zii-imx6q-rdu2/board.c
@@ -15,6 +15,7 @@
#include <common.h>
#include <envfs.h>
+#include <fs.h>
#include <gpio.h>
#include <init.h>
#include <mach/bbu.h>
@@ -151,3 +152,31 @@ static int rdu2_devices_init(void)
return 0;
}
device_initcall(rdu2_devices_init);
+
+static int rdu2_i210_invm(void)
+{
+ int fd;
+ u32 val;
+
+ if (!of_machine_is_compatible("zii,imx6q-zii-rdu2") &&
+ !of_machine_is_compatible("zii,imx6qp-zii-rdu2"))
+ return 0;
+
+ fd = open("/dev/e1000-invm0", O_RDWR);
+ if (fd < 0) {
+ pr_err("could not open e1000 iNVM device!\n");
+ return fd;
+ }
+
+ pread(fd, &val, sizeof(val), 0);
+ if (val == 0x157b1a11) {
+ pr_debug("i210 already programmed correctly\n");
+ return 0;
+ }
+
+ val = 0x157b1a11;
+ pwrite(fd, &val, sizeof(val), 0);
+
+ return 0;
+}
+late_initcall(rdu2_i210_invm);
--
2.17.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2018-06-20 9:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-20 9:51 Lucas Stach [this message]
2018-06-20 18:08 ` 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=20180620095112.14944-1-l.stach@pengutronix.de \
--to=l.stach@pengutronix.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