summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-01-10 13:19:01 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-01-23 14:55:18 +0100
commit95fe5b1f46607bebf80fb843f2e89f58e0d0e1f7 (patch)
tree7e09b4696471589e34469112c34b3b0df4465fde
parent1342fad09c897f2bec6780d96cfb550ba395eb9d (diff)
downloadrtems-libbsd-95fe5b1f46607bebf80fb843f2e89f58e0d0e1f7.tar.bz2
dpaa: Use device tree throughout in BMan init
Update #3277.
-rw-r--r--linux/drivers/soc/fsl/qbman/bman_ccsr.c62
1 files changed, 26 insertions, 36 deletions
diff --git a/linux/drivers/soc/fsl/qbman/bman_ccsr.c b/linux/drivers/soc/fsl/qbman/bman_ccsr.c
index 830f319f..0c3726e1 100644
--- a/linux/drivers/soc/fsl/qbman/bman_ccsr.c
+++ b/linux/drivers/soc/fsl/qbman/bman_ccsr.c
@@ -312,55 +312,48 @@ bman_sysinit(void)
int cpu;
int ret;
int node;
- int parent;
-
-#if QORIQ_CHIP_IS_T_VARIANT(QORIQ_CHIP_VARIANT)
- qoriq_reset_qman_and_bman();
- qoriq_clear_ce_portal(&qoriq_bman_portal[0][0],
- sizeof(qoriq_bman_portal[0]));
- qoriq_clear_ci_portal(&qoriq_bman_portal[1][0],
- sizeof(qoriq_bman_portal[1]));
-#endif
memset(&dn, 0, sizeof(dn));
name = "fsl,bman";
- node = fdt_node_offset_by_compatible(fdt, 0, name);
- if (node < 0)
- panic("bman: no bman in FDT");
+ node = fdt_node_offset_by_compatible(fdt, -1, name);
+ if (node >= 0) {
+#if QORIQ_CHIP_IS_T_VARIANT(QORIQ_CHIP_VARIANT)
+ qoriq_reset_qman_and_bman();
+ qoriq_clear_ce_portal(&qoriq_bman_portal[0][0],
+ sizeof(qoriq_bman_portal[0]));
+ qoriq_clear_ci_portal(&qoriq_bman_portal[1][0],
+ sizeof(qoriq_bman_portal[1]));
+#endif
- dn.full_name = name;
- dn.offset = node;
- ret = fsl_bman_probe(&ofdev);
- if (ret != 0)
- panic("bman: probe failed");
+ dn.full_name = name;
+ dn.offset = node;
+ ret = fsl_bman_probe(&ofdev);
+ if (ret != 0)
+ panic("bman: probe failed");
+ }
name = "fsl,bman-portal";
- node = fdt_node_offset_by_compatible(fdt, 0, name);
- if (node < 0)
- panic("bman: no portals in FDT");
- parent = fdt_parent_offset(fdt, node);
- if (parent < 0)
- panic("bman: no parent of portals in FDT");
- node = fdt_first_subnode(fdt, parent);
-
+ node = -1;
dn.full_name = name;
- dn.offset = node;
for (cpu = 0; cpu < cpu_count; ++cpu) {
struct bm_portal_config *pcfg = &bman_configs[cpu];
struct bman_portal *portal;
struct resource res;
+ node = fdt_node_offset_by_compatible(fdt, node, name);
if (node < 0)
- panic("bman: missing portal in FDT");
+ panic("bman: no affine portal for processor %i", cpu);
+
+ dn.offset = node;
ret = of_address_to_resource(&dn, 0, &res);
if (ret != 0)
panic("bman: no portal CE address");
-#if QORIQ_CHIP_IS_T_VARIANT(QORIQ_CHIP_VARIANT)
- pcfg->addr_virt[0] = (__iomem void *)
- ((uintptr_t)&qoriq_bman_portal[0][0] + (uintptr_t)res.start);
+ pcfg->addr_virt[0] = (__iomem void *)(uintptr_t)res.start;
+#if QORIQ_CHIP_IS_T_VARIANT(QORIQ_CHIP_VARIANT) && \
+ !defined(QORIQ_IS_HYPERVISOR_GUEST)
BSD_ASSERT((uintptr_t)pcfg->addr_virt[0] >=
(uintptr_t)&qoriq_bman_portal[0][0]);
BSD_ASSERT((uintptr_t)pcfg->addr_virt[0] <
@@ -370,9 +363,9 @@ bman_sysinit(void)
ret = of_address_to_resource(&dn, 1, &res);
if (ret != 0)
panic("bman: no portal CI address");
-#if QORIQ_CHIP_IS_T_VARIANT(QORIQ_CHIP_VARIANT)
- pcfg->addr_virt[1] = (__iomem void *)
- ((uintptr_t)&qoriq_bman_portal[0][0] + (uintptr_t)res.start);
+ pcfg->addr_virt[1] = (__iomem void *)(uintptr_t)res.start;
+#if QORIQ_CHIP_IS_T_VARIANT(QORIQ_CHIP_VARIANT) && \
+ !defined(QORIQ_IS_HYPERVISOR_GUEST)
BSD_ASSERT((uintptr_t)pcfg->addr_virt[1] >=
(uintptr_t)&qoriq_bman_portal[1][0]);
BSD_ASSERT((uintptr_t)pcfg->addr_virt[1] <
@@ -390,9 +383,6 @@ bman_sysinit(void)
panic("bman: cannot create portal");
bman_p_irqsource_add(portal, BM_PIRQ_RCRI);
-
- node = fdt_next_subnode(fdt, node);
- dn.offset = node;
}
}
SYSINIT(bman, SI_SUB_CPU, SI_ORDER_FIRST, bman_sysinit, NULL);