From: Lucas Stach <l.stach@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH] ARM: zii-common: reuse i210 config check for RDU3
Date: Wed, 20 Mar 2019 14:45:03 +0100 [thread overview]
Message-ID: <20190320134503.27194-1-l.stach@pengutronix.de> (raw)
The i210 on the RDU3 must be configured in the same way as on RDU2.
Move the config check/patching to the common directory and add the
compatible of the RDU3 boards.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
arch/arm/boards/zii-common/board.c | 30 ++++++++++++++++++++++++++
arch/arm/boards/zii-imx6q-rdu2/board.c | 29 -------------------------
2 files changed, 30 insertions(+), 29 deletions(-)
diff --git a/arch/arm/boards/zii-common/board.c b/arch/arm/boards/zii-common/board.c
index 254b09a7a768..1a9dadf5fb09 100644
--- a/arch/arm/boards/zii-common/board.c
+++ b/arch/arm/boards/zii-common/board.c
@@ -42,3 +42,33 @@ static int rdu_networkconfig(void)
return 0;
}
late_initcall(rdu_networkconfig);
+
+#define I210_CFGWORD_PCIID_157B 0x157b1a11
+static int rdu_i210_invm(void)
+{
+ int fd;
+ u32 val;
+
+ if (!of_machine_is_compatible("zii,imx6q-zii-rdu2") &&
+ !of_machine_is_compatible("zii,imx6qp-zii-rdu2") &&
+ !of_machine_is_compatible("zii,imx8mq-ultra"))
+ 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 == I210_CFGWORD_PCIID_157B) {
+ pr_debug("i210 already programmed correctly\n");
+ return 0;
+ }
+
+ val = I210_CFGWORD_PCIID_157B;
+ pwrite(fd, &val, sizeof(val), 0);
+
+ return 0;
+}
+late_initcall(rdu_i210_invm);
diff --git a/arch/arm/boards/zii-imx6q-rdu2/board.c b/arch/arm/boards/zii-imx6q-rdu2/board.c
index 344a654f23f1..6adb0b1c6fbc 100644
--- a/arch/arm/boards/zii-imx6q-rdu2/board.c
+++ b/arch/arm/boards/zii-imx6q-rdu2/board.c
@@ -214,35 +214,6 @@ static int rdu2_ethernet_init(void)
}
late_initcall(rdu2_ethernet_init);
-#define I210_CFGWORD_PCIID_157B 0x157b1a11
-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 == I210_CFGWORD_PCIID_157B) {
- pr_debug("i210 already programmed correctly\n");
- return 0;
- }
-
- val = I210_CFGWORD_PCIID_157B;
- pwrite(fd, &val, sizeof(val), 0);
-
- return 0;
-}
-late_initcall(rdu2_i210_invm);
-
static int rdu2_fixup_egalax_ts(struct device_node *root, void *context)
{
struct device_node *np;
--
2.20.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2019-03-20 13:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-20 13:45 Lucas Stach [this message]
2019-03-21 7:22 ` 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=20190320134503.27194-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