summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucas Stach <l.stach@pengutronix.de>2019-03-20 14:45:03 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2019-03-27 08:38:11 +0100
commitd76ba38a1605000a0ce712e9c060ed64422f1aff (patch)
tree25f26c64eaa3560f38f4eee0533bb2a67cf6fd27
parent5c1c2b29606be6dfae3753107fb6a7f9011f3a09 (diff)
downloadbarebox-d76ba38a1605000a0ce712e9c060ed64422f1aff.tar.gz
ARM: zii-common: reuse i210 config check for RDU3
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> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--arch/arm/boards/zii-common/board.c31
-rw-r--r--arch/arm/boards/zii-imx6q-rdu2/board.c29
2 files changed, 31 insertions, 29 deletions
diff --git a/arch/arm/boards/zii-common/board.c b/arch/arm/boards/zii-common/board.c
index 254b09a..20ec64d 100644
--- a/arch/arm/boards/zii-common/board.c
+++ b/arch/arm/boards/zii-common/board.c
@@ -15,6 +15,7 @@
#include <common.h>
#include <globalvar.h>
#include <init.h>
+#include <fs.h>
static int rdu_networkconfig(void)
{
@@ -42,3 +43,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 344a654..6adb0b1 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;