mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] net: fsl-fman: Disable unused network interfaces
Date: Thu, 28 Nov 2019 10:30:13 +0100	[thread overview]
Message-ID: <20191128093013.5504-1-s.hauer@pengutronix.de> (raw)

The Linux dts files have all network interfaces enabled. We have
to disable the ones that are unused.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/net/fsl-fman.c | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/drivers/net/fsl-fman.c b/drivers/net/fsl-fman.c
index 4e6bb2ecfd..153d4f9ed2 100644
--- a/drivers/net/fsl-fman.c
+++ b/drivers/net/fsl-fman.c
@@ -1333,3 +1333,41 @@ static struct driver_d fman_driver = {
 	.of_compatible = DRV_OF_COMPAT(fsl_fman_dt_ids),
 };
 device_platform_driver(fman_driver);
+
+static int fman_of_fixup(struct device_node *root, void *context)
+{
+	struct device_node *fman, *fman_bb;
+	struct device_node *child, *child_bb;
+
+	fman_bb = of_find_compatible_node(NULL, NULL, "fsl,fman");
+	fman = of_find_compatible_node(root, NULL, "fsl,fman");
+
+	/*
+	 * The dts files in the Linux tree have all network interfaces
+	 * enabled. Disable the ones that are disabled under barebox
+	 * as well.
+	 */
+	for_each_child_of_node(fman, child) {
+		if (!of_device_is_compatible(child, "fsl,fman-memac"))
+			continue;
+
+		child_bb = of_get_child_by_name(fman_bb, child->name);
+		if (!child_bb)
+			continue;
+
+		if (of_device_is_available(child_bb))
+			of_device_enable(child);
+		else
+			of_device_disable(child);
+	}
+
+	return 0;
+}
+
+static int fman_register_of_fixup(void)
+{
+	of_register_fixup(fman_of_fixup, NULL);
+
+	return 0;
+}
+late_initcall(fman_register_of_fixup);
-- 
2.24.0


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

                 reply	other threads:[~2019-11-28  9:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20191128093013.5504-1-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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