summaryrefslogtreecommitdiffstats
path: root/arch/arm/boards/zii-common/board.c
diff options
context:
space:
mode:
authorLucas Stach <l.stach@pengutronix.de>2019-03-13 11:56:33 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2019-03-18 09:06:22 +0100
commit45b130e467849b659f3124eed6e5e93dd991e2f6 (patch)
treed0e6ed7083baf89fb18dd0f406c2762200047822 /arch/arm/boards/zii-common/board.c
parent00a22cb6ad45ed5d1c3008c28ae8967797830400 (diff)
downloadbarebox-45b130e467849b659f3124eed6e5e93dd991e2f6.tar.gz
barebox-45b130e467849b659f3124eed6e5e93dd991e2f6.tar.xz
ARM: zii-common: fetch network config from SP
On both RDU1 and RDU2 the seat notwork configuration is stored in a configuration EEPROM accessible via the RAVE SP. Add an initcall to fetch this configuration and add it to the kernel command line. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/boards/zii-common/board.c')
-rw-r--r--arch/arm/boards/zii-common/board.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/arch/arm/boards/zii-common/board.c b/arch/arm/boards/zii-common/board.c
new file mode 100644
index 0000000000..254b09a7a7
--- /dev/null
+++ b/arch/arm/boards/zii-common/board.c
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2019 Zodiac Inflight Innovation
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <common.h>
+#include <globalvar.h>
+#include <init.h>
+
+static int rdu_networkconfig(void)
+{
+ static char *rdu_netconfig;
+ struct device_d *sp_dev;
+
+ if (!of_machine_is_compatible("zii,imx6q-zii-rdu2") &&
+ !of_machine_is_compatible("zii,imx6qp-zii-rdu2") &&
+ !of_machine_is_compatible("zii,imx51-rdu1"))
+ return 0;
+
+ sp_dev = get_device_by_name("sp");
+ if (!sp_dev) {
+ pr_warn("no sp device found, network config not available!\n");
+ return -ENODEV;
+ }
+
+ rdu_netconfig = basprintf("ip=%s:::%s::eth0:",
+ dev_get_param(sp_dev, "ipaddr"),
+ dev_get_param(sp_dev, "netmask"));
+
+ globalvar_add_simple_string("linux.bootargs.rdu_network",
+ &rdu_netconfig);
+
+ return 0;
+}
+late_initcall(rdu_networkconfig);