From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 1/3] mvebu: simplify detection and fixup of MV78230-A0
Date: Tue, 14 Feb 2017 11:53:56 +0100 [thread overview]
Message-ID: <20170214105358.6666-1-u.kleine-koenig@pengutronix.de> (raw)
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
next reply other threads:[~2017-02-14 10:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-14 10:53 Uwe Kleine-König [this message]
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
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=20170214105358.6666-1-u.kleine-koenig@pengutronix.de \
--to=u.kleine-koenig@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