diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2017-02-14 11:53:56 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2017-02-16 08:15:47 +0100 |
commit | 708af51dce0c0ab0a3c2b8cf3912fe2b123a79ba (patch) | |
tree | ee05b9f30b5fab483917acea6d0b79e16222d283 /arch/arm/mach-mvebu | |
parent | 9de72c2e4f84b345b11b09e25de0ca6f2675340b (diff) | |
download | barebox-708af51dce0c0ab0a3c2b8cf3912fe2b123a79ba.tar.gz barebox-708af51dce0c0ab0a3c2b8cf3912fe2b123a79ba.tar.xz |
mvebu: simplify detection and fixup of MV78230-A0
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-mvebu')
-rw-r--r-- | arch/arm/mach-mvebu/armada-370-xp.c | 31 |
1 files 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 c362cfdabe..cc0d7bd612 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); |