* [PATCH] ARM: zii-common: reuse i210 config check for RDU3
@ 2019-03-20 13:45 Lucas Stach
2019-03-21 7:22 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Lucas Stach @ 2019-03-20 13:45 UTC (permalink / raw)
To: barebox
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] ARM: zii-common: reuse i210 config check for RDU3
2019-03-20 13:45 [PATCH] ARM: zii-common: reuse i210 config check for RDU3 Lucas Stach
@ 2019-03-21 7:22 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2019-03-21 7:22 UTC (permalink / raw)
To: Lucas Stach; +Cc: barebox
On Wed, Mar 20, 2019 at 02:45:03PM +0100, Lucas Stach wrote:
> 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(-)
Applied, thanks
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-03-21 7:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-20 13:45 [PATCH] ARM: zii-common: reuse i210 config check for RDU3 Lucas Stach
2019-03-21 7:22 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox