diff options
author | Jeffrey Ladouceur <Jeffrey.Ladouceur@freescale.com> | 2014-05-23 15:35:58 (GMT) |
---|---|---|
committer | Jose Rivera <German.Rivera@freescale.com> | 2014-05-24 04:19:49 (GMT) |
commit | 99a5e1c100c6dd6330f000fae498f077ad85c84a (patch) | |
tree | b8fed582c19bc239df2f4670e119344c59893693 /drivers | |
parent | 3fe6b293a154089a030a5e7ee86a283fab2eb54a (diff) | |
download | linux-fsl-qoriq-99a5e1c100c6dd6330f000fae498f077ad85c84a.tar.xz |
fsl_qbman: Fix DCP assignment for version of QMan
For QMan version 3.1.2 the DCE Channel number is different.
QMan contains a cfg revision number which is a direct correlation.
Add this attribute and fix up the dce channel number based on qman revision info.
Signed-off-by: Jeffrey Ladouceur <Jeffrey.Ladouceur@freescale.com>
Change-Id: I0ff79ec01f741fb71caf0a9d4f0a9f3760d64f15
Reviewed-on: http://git.am.freescale.net:8181/12851
Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com>
Reviewed-by: Haiying Wang <Haiying.Wang@freescale.com>
Reviewed-by: Geoff Thorpe <Geoff.Thorpe@freescale.com>
Reviewed-by: Jose Rivera <German.Rivera@freescale.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/fsl_qbman/qman_config.c | 12 | ||||
-rw-r--r-- | drivers/staging/fsl_qbman/qman_driver.c | 11 | ||||
-rw-r--r-- | drivers/staging/fsl_qbman/qman_private.h | 7 |
3 files changed, 26 insertions, 4 deletions
diff --git a/drivers/staging/fsl_qbman/qman_config.c b/drivers/staging/fsl_qbman/qman_config.c index 8a10c22..706d3ec 100644 --- a/drivers/staging/fsl_qbman/qman_config.c +++ b/drivers/staging/fsl_qbman/qman_config.c @@ -340,12 +340,15 @@ static void qm_set_corenet_initiator(struct qman *qm) CONFIG_FSL_QMAN_CI_SCHED_CFG_BMAN_W); } -static void qm_get_version(struct qman *qm, u16 *id, u8 *major, u8 *minor) +static void qm_get_version(struct qman *qm, u16 *id, u8 *major, u8 *minor, + u8 *cfg) { u32 v = qm_in(IP_REV_1); + u32 v2 = qm_in(IP_REV_2); *id = (v >> 16); *major = (v >> 8) & 0xff; *minor = v & 0xff; + *cfg = v2 & 0xff; } static void qm_set_memory(struct qman *qm, enum qm_memory memory, u64 ba, @@ -491,7 +494,7 @@ static int __init fsl_qman_init(struct device_node *node) const char *s; int ret, standby = 0; u16 id; - u8 major, minor; + u8 major, minor, cfg; ret = of_address_to_resource(node, 0, &res); if (ret) { pr_err("Can't get %s property '%s'\n", node->full_name, "reg"); @@ -512,8 +515,8 @@ static int __init fsl_qman_init(struct device_node *node) regs = ioremap(res.start, res.end - res.start + 1); qm = qm_create(regs); qm_node = node; - qm_get_version(qm, &id, &major, &minor); - pr_info("Qman ver:%04x,%02x,%02x\n", id, major, minor); + qm_get_version(qm, &id, &major, &minor, &cfg); + pr_info("Qman ver:%04x,%02x,%02x,%02x\n", id, major, minor, cfg); if (!qman_ip_rev) { if ((major == 1) && (minor == 0)) { pr_err("QMAN rev1.0 on P4080 rev1 is not supported!\n"); @@ -533,6 +536,7 @@ static int __init fsl_qman_init(struct device_node *node) pr_warn("unknown Qman version, default to rev1.1\n"); qman_ip_rev = QMAN_REV11; } + qman_ip_cfg = cfg; } if (standby) { diff --git a/drivers/staging/fsl_qbman/qman_driver.c b/drivers/staging/fsl_qbman/qman_driver.c index f5049b1..d74369b 100644 --- a/drivers/staging/fsl_qbman/qman_driver.c +++ b/drivers/staging/fsl_qbman/qman_driver.c @@ -40,6 +40,8 @@ * where CCSR isn't available) */ u16 qman_ip_rev; EXPORT_SYMBOL(qman_ip_rev); +u8 qman_ip_cfg; +EXPORT_SYMBOL(qman_ip_cfg); u16 qm_channel_pool1 = QMAN_CHANNEL_POOL1; EXPORT_SYMBOL(qm_channel_pool1); u16 qm_channel_caam = QMAN_CHANNEL_CAAM; @@ -291,6 +293,7 @@ static __init int fsl_ceetm_init(struct device_node *node) static void qman_get_ip_revision(struct device_node *dn) { u16 ip_rev = 0; + u8 ip_cfg = QMAN_REV_CFG_0; for_each_compatible_node(dn, NULL, "fsl,qman-portal") { if (!of_device_is_available(dn)) continue; @@ -318,6 +321,7 @@ static void qman_get_ip_revision(struct device_node *dn) "fsl,qman-portal-3.0.1")) { ip_rev = QMAN_REV30; qman_portal_max = 25; + ip_cfg = QMAN_REV_CFG_1; } else if (of_device_is_compatible(dn, "fsl,qman-portal-3.1.0")) { ip_rev = QMAN_REV31; @@ -326,14 +330,17 @@ static void qman_get_ip_revision(struct device_node *dn) "fsl,qman-portal-3.1.1")) { ip_rev = QMAN_REV31; qman_portal_max = 25; + ip_cfg = QMAN_REV_CFG_1; } else if (of_device_is_compatible(dn, "fsl,qman-portal-3.1.2")) { ip_rev = QMAN_REV31; qman_portal_max = 18; + ip_cfg = QMAN_REV_CFG_2; } else if (of_device_is_compatible(dn, "fsl,qman-portal-3.1.3")) { ip_rev = QMAN_REV31; qman_portal_max = 10; + ip_cfg = QMAN_REV_CFG_3; } else { pr_warn("unknown QMan version in portal node," "default to rev1.1\n"); @@ -344,10 +351,12 @@ static void qman_get_ip_revision(struct device_node *dn) if (!qman_ip_rev) { if (ip_rev) { qman_ip_rev = ip_rev; + qman_ip_cfg = ip_cfg; } else { pr_warn("unknown Qman version," " default to rev1.1\n"); qman_ip_rev = QMAN_REV11; + qman_ip_cfg = QMAN_REV_CFG_0; } } else if (ip_rev && (qman_ip_rev != ip_rev)) pr_warn("Revision=0x%04x, but portal '%s' has" @@ -760,6 +769,8 @@ __init int qman_init(void) qm_channel_caam = QMAN_CHANNEL_CAAM_REV3; qm_channel_pme = QMAN_CHANNEL_PME_REV3; } + if ((qman_ip_rev == QMAN_REV31) && (qman_ip_cfg == QMAN_REV_CFG_2)) + qm_channel_dce = QMAN_CHANNEL_DCE_QMANREV312; /* * Parse the ceetm node to get how many ceetm instances are supported diff --git a/drivers/staging/fsl_qbman/qman_private.h b/drivers/staging/fsl_qbman/qman_private.h index b6e7e62..e9f60d5 100644 --- a/drivers/staging/fsl_qbman/qman_private.h +++ b/drivers/staging/fsl_qbman/qman_private.h @@ -193,7 +193,14 @@ struct qm_portal_config { #define QMAN_REV20 0x0200 #define QMAN_REV30 0x0300 #define QMAN_REV31 0x0301 +/* QMan REV_2 register contains the Cfg option */ +#define QMAN_REV_CFG_0 0x0 +#define QMAN_REV_CFG_1 0x1 +#define QMAN_REV_CFG_2 0x2 +#define QMAN_REV_CFG_3 0x3 + extern u16 qman_ip_rev; /* 0 if uninitialised, otherwise QMAN_REVx */ +extern u8 qman_ip_cfg; extern u32 qman_clk; extern u16 qman_portal_max; |