summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Smirnov <andrew.smirnov@gmail.com>2019-03-13 11:56:35 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2019-03-18 09:06:22 +0100
commitf6081dd12de10d07a488bd00fc3adaea133572bc (patch)
treeb10da69c3240393ba7ddf9c6b50595f8cc366bb7
parent40a9662174cf902e86994fe66bf67a869ef519c0 (diff)
downloadbarebox-f6081dd12de10d07a488bd00fc3adaea133572bc.tar.gz
barebox-f6081dd12de10d07a488bd00fc3adaea133572bc.tar.xz
ARM: rdu2: patch DSA config
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> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--arch/arm/boards/zii-imx6q-rdu2/board.c46
1 files 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 1733897a1a..344a654f23 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),