armv8: ls1046a: add icid setup for qman portals

Add support for ICID setting of qman portals and the required device
tree fixups. Also fix an endiness issue in portal setup code.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
lime2-spi
Laurentiu Tudor 6 years ago committed by York Sun
parent 3cb4fe65f9
commit 599a97d49c
  1. 16
      arch/arm/cpu/armv8/fsl-layerscape/ls1046_ids.c
  2. 24
      arch/arm/include/asm/arch-fsl-layerscape/fsl_portals.h
  3. 43
      drivers/misc/fsl_portals.c

@ -6,6 +6,22 @@
#include <common.h> #include <common.h>
#include <asm/arch-fsl-layerscape/immap_lsch2.h> #include <asm/arch-fsl-layerscape/immap_lsch2.h>
#include <asm/arch-fsl-layerscape/fsl_icid.h> #include <asm/arch-fsl-layerscape/fsl_icid.h>
#include <asm/arch-fsl-layerscape/fsl_portals.h>
#ifdef CONFIG_SYS_DPAA_QBMAN
struct qportal_info qp_info[CONFIG_SYS_QMAN_NUM_PORTALS] = {
SET_QP_INFO(FSL_DPAA1_STREAM_ID_END, 0),
SET_QP_INFO(FSL_DPAA1_STREAM_ID_END, 0),
SET_QP_INFO(FSL_DPAA1_STREAM_ID_END, 0),
SET_QP_INFO(FSL_DPAA1_STREAM_ID_END, 0),
SET_QP_INFO(FSL_DPAA1_STREAM_ID_END, 0),
SET_QP_INFO(FSL_DPAA1_STREAM_ID_END, 0),
SET_QP_INFO(FSL_DPAA1_STREAM_ID_END, 0),
SET_QP_INFO(FSL_DPAA1_STREAM_ID_END, 0),
SET_QP_INFO(FSL_DPAA1_STREAM_ID_END, 0),
SET_QP_INFO(FSL_DPAA1_STREAM_ID_END, 0),
};
#endif
struct icid_id_table icid_tbl[] = { struct icid_id_table icid_tbl[] = {
#ifdef CONFIG_SYS_DPAA_QBMAN #ifdef CONFIG_SYS_DPAA_QBMAN

@ -0,0 +1,24 @@
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright 2018 NXP
*/
#ifndef _FSL_PORTALS_H_
#define _FSL_PORTALS_H_
struct qportal_info {
u16 dicid; /* DQRR ICID */
u16 ficid; /* frame data ICID */
u16 icid;
u8 sdest;
};
#define SET_QP_INFO(streamid, dest) \
{ .dicid = (streamid), .ficid = (streamid), .icid = (streamid), \
.sdest = (dest) }
extern struct qportal_info qp_info[];
void fdt_portal(void *blob, const char *compat, const char *container,
u64 addr, u32 size);
#endif

@ -13,6 +13,9 @@
#ifdef CONFIG_PPC #ifdef CONFIG_PPC
#include <asm/fsl_portals.h> #include <asm/fsl_portals.h>
#include <asm/fsl_liodn.h> #include <asm/fsl_liodn.h>
#else
#include <asm/arch-fsl-layerscape/fsl_portals.h>
#include <asm/arch-fsl-layerscape/fsl_icid.h>
#endif #endif
#include <fsl_qbman.h> #include <fsl_qbman.h>
@ -45,6 +48,22 @@ void setup_qbman_portals(void)
/* set frame liodn */ /* set frame liodn */
out_be32(&qman->qcsp[i].qcsp_io_cfg, (sdest << 16) | fliodn); out_be32(&qman->qcsp[i].qcsp_io_cfg, (sdest << 16) | fliodn);
} }
#else
#ifdef CONFIG_ARCH_LS1046A
int i;
for (i = 0; i < CONFIG_SYS_QMAN_NUM_PORTALS; i++) {
u8 sdest = qp_info[i].sdest;
u16 ficid = qp_info[i].ficid;
u16 dicid = qp_info[i].dicid;
u16 icid = qp_info[i].icid;
out_be32(&qman->qcsp[i].qcsp_lio_cfg, (icid << 16) |
dicid);
/* set frame icid */
out_be32(&qman->qcsp[i].qcsp_io_cfg, (sdest << 16) | ficid);
}
#endif
#endif #endif
/* Change default state of BMan ISDR portals to all 1s */ /* Change default state of BMan ISDR portals to all 1s */
@ -178,6 +197,10 @@ void fdt_fixup_qportals(void *blob)
char compat[64]; char compat[64];
int compat_len; int compat_len;
#ifdef CONFIG_ARCH_LS1046A
int smmu_ph = fdt_get_smmu_phandle(blob);
#endif
maj = (rev_1 >> 8) & 0xff; maj = (rev_1 >> 8) & 0xff;
min = rev_1 & 0xff; min = rev_1 & 0xff;
ip_cfg = rev_2 & 0xff; ip_cfg = rev_2 & 0xff;
@ -188,7 +211,7 @@ void fdt_fixup_qportals(void *blob)
off = fdt_node_offset_by_compatible(blob, -1, "fsl,qman-portal"); off = fdt_node_offset_by_compatible(blob, -1, "fsl,qman-portal");
while (off != -FDT_ERR_NOTFOUND) { while (off != -FDT_ERR_NOTFOUND) {
#ifdef CONFIG_PPC #if defined(CONFIG_PPC) || defined(CONFIG_ARCH_LS1046A)
#ifdef CONFIG_FSL_CORENET #ifdef CONFIG_FSL_CORENET
u32 liodns[2]; u32 liodns[2];
#endif #endif
@ -198,12 +221,12 @@ void fdt_fixup_qportals(void *blob)
if (!ci) if (!ci)
goto err; goto err;
i = *ci; i = fdt32_to_cpu(*ci);
#ifdef CONFIG_SYS_DPAA_FMAN #if defined(CONFIG_SYS_DPAA_FMAN) && defined(CONFIG_PPC)
int j; int j;
#endif #endif
#endif /* CONFIG_PPC */ #endif /* CONFIG_PPC || CONFIG_ARCH_LS1046A */
err = fdt_setprop(blob, off, "compatible", compat, compat_len); err = fdt_setprop(blob, off, "compatible", compat, compat_len);
if (err < 0) if (err < 0)
goto err; goto err;
@ -251,6 +274,18 @@ void fdt_fixup_qportals(void *blob)
if (err < 0) if (err < 0)
goto err; goto err;
#endif #endif
#else
#ifdef CONFIG_ARCH_LS1046A
if (smmu_ph >= 0) {
u32 icids[3];
icids[0] = qp_info[i].icid;
icids[1] = qp_info[i].dicid;
icids[2] = qp_info[i].ficid;
fdt_set_iommu_prop(blob, off, smmu_ph, icids, 3);
}
#endif
#endif /* CONFIG_PPC */ #endif /* CONFIG_PPC */
err: err:

Loading…
Cancel
Save