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 6/6] ARM: rdu2: patch DSA config
Date: Wed, 13 Mar 2019 11:56:35 +0100	[thread overview]
Message-ID: <20190313105635.22055-6-l.stach@pengutronix.de> (raw)
In-Reply-To: <20190313105635.22055-1-l.stach@pengutronix.de>

From: Andrey Smirnov <andrew.smirnov@gmail.com>

This patches the DSA switch config in the kernel DT if the unit is
a 12.1" one, which doesn't have the FEC wired up to the switch.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
[andrew.smirnov@gmail.com: Ported the patch to use p/n fixups]
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 arch/arm/boards/zii-imx6q-rdu2/board.c | 46 ++++++++++++++++++++++++--
 1 file changed, 44 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boards/zii-imx6q-rdu2/board.c b/arch/arm/boards/zii-imx6q-rdu2/board.c
index 1733897a1a40..344a654f23f1 100644
--- a/arch/arm/boards/zii-imx6q-rdu2/board.c
+++ b/arch/arm/boards/zii-imx6q-rdu2/board.c
@@ -38,6 +38,7 @@ enum rdu2_lvds_busformat {
 };
 
 #define RDU2_LRU_FLAG_EGALAX	BIT(0)
+#define RDU2_LRU_FLAG_NO_FEC	BIT(1)
 
 struct rdu2_lru_fixup {
 	struct zii_pn_fixup fixup;
@@ -269,6 +270,44 @@ static int rdu2_fixup_egalax_ts(struct device_node *root, void *context)
 	return 0;
 }
 
+static int rdu2_fixup_dsa(struct device_node *root, void *context)
+{
+	struct device_node *switch_np, *np;
+	phandle i210_handle;
+
+	/*
+	 * The 12.1" unit has no FEC connection, so we need to rewrite
+	 * the i210 port into the CPU port and delete the FEC port,
+	 * which is part of the common setup.
+	 */
+	pr_info("Rewriting i210 switch port into CPU port\n");
+
+	switch_np = of_find_compatible_node(root, NULL, "marvell,mv88e6085");
+	if (!switch_np)
+		return -ENODEV;
+
+	np = of_find_node_by_name(switch_np, "port@2");
+	if (!np)
+		return -ENODEV;
+
+	of_delete_node(np);
+
+	np = of_find_node_by_name(root, "i210@0");
+	if (!np)
+		return -ENODEV;
+
+	i210_handle = of_node_create_phandle(np);
+
+	np = of_find_node_by_name(switch_np, "port@0");
+	if (!np)
+		return -ENODEV;
+
+	of_property_write_u32(np, "ethernet", i210_handle);
+	of_property_write_string(np, "label", "cpu");
+
+	return 0;
+}
+
 static int rdu2_fixup_edp(struct device_node *root)
 {
 	const bool kernel_fixup = root != NULL;
@@ -391,6 +430,9 @@ static void rdu2_lru_fixup(const struct zii_pn_fixup *context)
 
 	if (fixup->flags & RDU2_LRU_FLAG_EGALAX)
 		of_register_fixup(rdu2_fixup_egalax_ts, NULL);
+
+	if (fixup->flags & RDU2_LRU_FLAG_NO_FEC)
+		of_register_fixup(rdu2_fixup_dsa, NULL);
 }
 
 #define RDU2_LRU_FIXUP(__pn, __flags, __panel)		\
@@ -409,8 +451,8 @@ static void rdu2_lru_fixup(const struct zii_pn_fixup *context)
 #define RDU2_PANEL_32P0	IT_DUAL_LVDS,   BF_SPWG,  "auo,p320hvn03"
 
 static const struct rdu2_lru_fixup rdu2_lru_fixups[] = {
-	RDU2_LRU_FIXUP("00-5122-01", 0, RDU2_PANEL_12P1),
-	RDU2_LRU_FIXUP("00-5122-02", 0, RDU2_PANEL_12P1),
+	RDU2_LRU_FIXUP("00-5122-01", RDU2_LRU_FLAG_NO_FEC, RDU2_PANEL_12P1),
+	RDU2_LRU_FIXUP("00-5122-02", RDU2_LRU_FLAG_NO_FEC, RDU2_PANEL_12P1),
 	RDU2_LRU_FIXUP("00-5120-01", 0, RDU2_PANEL_10P1),
 	RDU2_LRU_FIXUP("00-5120-02", 0, RDU2_PANEL_10P1),
 	RDU2_LRU_FIXUP("00-5120-51", 0, RDU2_PANEL_10P1),
-- 
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 ` [PATCH 4/6] ARM: zii-common: fetch network config from SP Lucas Stach
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 ` Lucas Stach [this message]
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-6-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