mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Lucas Stach <l.stach@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>,
	Chris Healy <cphealy@gmail.com>
Subject: [PATCH 4/6] ARM: zii-common: fetch network config from SP
Date: Wed, 13 Mar 2019 11:56:33 +0100	[thread overview]
Message-ID: <20190313105635.22055-4-l.stach@pengutronix.de> (raw)
In-Reply-To: <20190313105635.22055-1-l.stach@pengutronix.de>

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>
---
 arch/arm/boards/zii-common/Makefile |  2 +-
 arch/arm/boards/zii-common/board.c  | 44 +++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boards/zii-common/board.c

diff --git a/arch/arm/boards/zii-common/Makefile b/arch/arm/boards/zii-common/Makefile
index 057f2a89c647..fcc5cdf97dd5 100644
--- a/arch/arm/boards/zii-common/Makefile
+++ b/arch/arm/boards/zii-common/Makefile
@@ -1 +1 @@
-obj-y += switch-cmd.o pn-fixup.o
+obj-y += board.o switch-cmd.o pn-fixup.o
diff --git a/arch/arm/boards/zii-common/board.c b/arch/arm/boards/zii-common/board.c
new file mode 100644
index 000000000000..254b09a7a768
--- /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);
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2019-03-13 10:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-13 10:56 [PATCH 1/6] ARM: add Zii common directory and move switch reset command Lucas Stach
2019-03-13 10:56 ` [PATCH 2/6] ARM: zii-common: add support for switch reset on RDU1 Lucas Stach
2019-03-13 10:56 ` [PATCH 3/6] ARM: zii-common: introduce RDU part-number based fixup abstraction Lucas Stach
2019-03-13 10:56 ` Lucas Stach [this message]
2019-03-13 10:56 ` [PATCH 5/6] ARM: rdu2: Add p/n based fixups for touchscreen and display panel Lucas Stach
2019-03-13 10:56 ` [PATCH 6/6] ARM: rdu2: patch DSA config Lucas Stach
2019-03-18  8:06 ` [PATCH 1/6] ARM: add Zii common directory and move switch reset command 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=20190313105635.22055-4-l.stach@pengutronix.de \
    --to=l.stach@pengutronix.de \
    --cc=andrew.smirnov@gmail.com \
    --cc=barebox@lists.infradead.org \
    --cc=cphealy@gmail.com \
    /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