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@xxxxxxxxxxxxxx> --- 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@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox