dpaa: Use device tree throughout in BMan init

Update #3277.
This commit is contained in:
Sebastian Huber 2018-01-10 13:19:01 +01:00
parent 1342fad09c
commit 95fe5b1f46

View File

@ -312,8 +312,12 @@ bman_sysinit(void)
int cpu; int cpu;
int ret; int ret;
int node; int node;
int parent;
memset(&dn, 0, sizeof(dn));
name = "fsl,bman";
node = fdt_node_offset_by_compatible(fdt, -1, name);
if (node >= 0) {
#if QORIQ_CHIP_IS_T_VARIANT(QORIQ_CHIP_VARIANT) #if QORIQ_CHIP_IS_T_VARIANT(QORIQ_CHIP_VARIANT)
qoriq_reset_qman_and_bman(); qoriq_reset_qman_and_bman();
qoriq_clear_ce_portal(&qoriq_bman_portal[0][0], qoriq_clear_ce_portal(&qoriq_bman_portal[0][0],
@ -322,45 +326,34 @@ bman_sysinit(void)
sizeof(qoriq_bman_portal[1])); sizeof(qoriq_bman_portal[1]));
#endif #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");
dn.full_name = name; dn.full_name = name;
dn.offset = node; dn.offset = node;
ret = fsl_bman_probe(&ofdev); ret = fsl_bman_probe(&ofdev);
if (ret != 0) if (ret != 0)
panic("bman: probe failed"); panic("bman: probe failed");
}
name = "fsl,bman-portal"; name = "fsl,bman-portal";
node = fdt_node_offset_by_compatible(fdt, 0, name); node = -1;
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);
dn.full_name = name; dn.full_name = name;
dn.offset = node;
for (cpu = 0; cpu < cpu_count; ++cpu) { for (cpu = 0; cpu < cpu_count; ++cpu) {
struct bm_portal_config *pcfg = &bman_configs[cpu]; struct bm_portal_config *pcfg = &bman_configs[cpu];
struct bman_portal *portal; struct bman_portal *portal;
struct resource res; struct resource res;
node = fdt_node_offset_by_compatible(fdt, node, name);
if (node < 0) 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); ret = of_address_to_resource(&dn, 0, &res);
if (ret != 0) if (ret != 0)
panic("bman: no portal CE address"); panic("bman: no portal CE address");
#if QORIQ_CHIP_IS_T_VARIANT(QORIQ_CHIP_VARIANT) pcfg->addr_virt[0] = (__iomem void *)(uintptr_t)res.start;
pcfg->addr_virt[0] = (__iomem void *) #if QORIQ_CHIP_IS_T_VARIANT(QORIQ_CHIP_VARIANT) && \
((uintptr_t)&qoriq_bman_portal[0][0] + (uintptr_t)res.start); !defined(QORIQ_IS_HYPERVISOR_GUEST)
BSD_ASSERT((uintptr_t)pcfg->addr_virt[0] >= BSD_ASSERT((uintptr_t)pcfg->addr_virt[0] >=
(uintptr_t)&qoriq_bman_portal[0][0]); (uintptr_t)&qoriq_bman_portal[0][0]);
BSD_ASSERT((uintptr_t)pcfg->addr_virt[0] < BSD_ASSERT((uintptr_t)pcfg->addr_virt[0] <
@ -370,9 +363,9 @@ bman_sysinit(void)
ret = of_address_to_resource(&dn, 1, &res); ret = of_address_to_resource(&dn, 1, &res);
if (ret != 0) if (ret != 0)
panic("bman: no portal CI address"); panic("bman: no portal CI address");
#if QORIQ_CHIP_IS_T_VARIANT(QORIQ_CHIP_VARIANT) pcfg->addr_virt[1] = (__iomem void *)(uintptr_t)res.start;
pcfg->addr_virt[1] = (__iomem void *) #if QORIQ_CHIP_IS_T_VARIANT(QORIQ_CHIP_VARIANT) && \
((uintptr_t)&qoriq_bman_portal[0][0] + (uintptr_t)res.start); !defined(QORIQ_IS_HYPERVISOR_GUEST)
BSD_ASSERT((uintptr_t)pcfg->addr_virt[1] >= BSD_ASSERT((uintptr_t)pcfg->addr_virt[1] >=
(uintptr_t)&qoriq_bman_portal[1][0]); (uintptr_t)&qoriq_bman_portal[1][0]);
BSD_ASSERT((uintptr_t)pcfg->addr_virt[1] < BSD_ASSERT((uintptr_t)pcfg->addr_virt[1] <
@ -390,9 +383,6 @@ bman_sysinit(void)
panic("bman: cannot create portal"); panic("bman: cannot create portal");
bman_p_irqsource_add(portal, BM_PIRQ_RCRI); 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); SYSINIT(bman, SI_SUB_CPU, SI_ORDER_FIRST, bman_sysinit, NULL);