mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/3] mvebu: simplify detection and fixup of MV78230-A0
@ 2017-02-14 10:53 Uwe Kleine-König
  2017-02-14 10:53 ` [PATCH 2/3] mvebu: remove unused function barebox_arm_reset_vector Uwe Kleine-König
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Uwe Kleine-König @ 2017-02-14 10:53 UTC (permalink / raw)
  To: barebox

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 arch/arm/mach-mvebu/armada-370-xp.c | 31 ++++++++++++-------------------
 1 file changed, 12 insertions(+), 19 deletions(-)

diff --git a/arch/arm/mach-mvebu/armada-370-xp.c b/arch/arm/mach-mvebu/armada-370-xp.c
index c362cfdabe22..cc0d7bd612e6 100644
--- a/arch/arm/mach-mvebu/armada-370-xp.c
+++ b/arch/arm/mach-mvebu/armada-370-xp.c
@@ -54,31 +54,24 @@ static const struct of_device_id armada_370_xp_pcie_of_ids[] = {
 	{ },
 };
 
-static int armada_370_xp_soc_id_fixup(void)
+/*
+ * Marvell Armada XP MV78230-A0 incorrectly identifies itself as
+ * MV78460. Check for DEVID_MV78460 but if there are only 2 CPUs
+ * present in Coherency Fabric, fixup PCIe PRODUCT_ID.
+ */
+static int armada_xp_soc_id_fixup(void)
 {
 	struct device_node *np, *cnp;
 	void __iomem *base;
-	u32 reg, ctrl, mask;
+	u32 reg, ctrl;
 	u32 socid, numcpus;
 
 	socid = readl(ARMADA_370_XP_CPU_SOC_ID) & CPU_SOC_ID_DEVICE_MASK;
 	numcpus = 1 + (readl(ARMADA_370_XP_FABRIC_CONF) & FABRIC_NUM_CPUS_MASK);
 
-	switch (socid) {
-	/*
-	 * Marvell Armada XP MV78230-A0 incorrectly identifies itself as
-	 * MV78460. Check for DEVID_MV78460 but if there are only 2 CPUs
-	 * present in Coherency Fabric, fixup PCIe PRODUCT_ID.
-	 */
-	case DEVID_MV78460:
-		if (numcpus != 2)
-			return 0;
-		socid = DEVID_MV78230;
-		mask = PCIE0_EN | PCIE1_EN | PCIE0_QUADX1_EN;
-		break;
-	default:
+	if (socid != DEVID_MV78460 || numcpus != 2)
+		/* not affected */
 		return 0;
-	}
 
 	np = of_find_matching_node(NULL, armada_370_xp_pcie_of_ids);
 	if (!np)
@@ -86,7 +79,7 @@ static int armada_370_xp_soc_id_fixup(void)
 
 	/* Enable all individual x1 ports */
 	ctrl = readl(ARMADA_370_XP_SOC_CTRL);
-	writel(ctrl | mask, ARMADA_370_XP_SOC_CTRL);
+	writel(ctrl | PCIE0_EN | PCIE1_EN | PCIE0_QUADX1_EN, ARMADA_370_XP_SOC_CTRL);
 
 	for_each_child_of_node(np, cnp) {
 		base = of_iomap(cnp, 0);
@@ -95,7 +88,7 @@ static int armada_370_xp_soc_id_fixup(void)
 
 		/* Fixup PCIe port DEVICE_ID */
 		reg = readl(base + PCIE_VEN_DEV_ID);
-		reg = (socid << 16) | (reg & 0xffff);
+		reg = (DEVID_MV78230 << 16) | (reg & 0xffff);
 		writel(reg, base + PCIE_VEN_DEV_ID);
 	}
 
@@ -148,7 +141,7 @@ static int armada_370_xp_init_soc(struct device_node *root, void *context)
 	mvebu_set_memory(phys_base, phys_size);
 	mvebu_mbus_init();
 
-	armada_370_xp_soc_id_fixup();
+	armada_xp_soc_id_fixup();
 
 	if (of_machine_is_compatible("marvell,armadaxp"))
 		armada_xp_init_soc(root);
-- 
2.11.0


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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-02-16  7:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-14 10:53 [PATCH 1/3] mvebu: simplify detection and fixup of MV78230-A0 Uwe Kleine-König
2017-02-14 10:53 ` [PATCH 2/3] mvebu: remove unused function barebox_arm_reset_vector Uwe Kleine-König
2017-02-14 10:53 ` [PATCH 3/3] mvebu: rework how memory is detected Uwe Kleine-König
2017-02-15 16:31   ` [PATCH 3/3] fixup! " Uwe Kleine-König
2017-02-15 16:42 ` [PATCH 4/3] mvebu: armada-370-xp: simplify soc init code flow Uwe Kleine-König
2017-02-15 16:42 ` [PATCH 5/3] mvebu: dove: " Uwe Kleine-König
2017-02-15 16:42 ` [PATCH 6/3] mvebu: kirkwood: " Uwe Kleine-König
2017-02-16  7:17   ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox