889aecc3838cf3c8c22f7b5de48125f186431552
[openwrt/staging/ynezz.git] /
1 From f34c01773d5dbd2db04200079bb4d32ecb0cd847 Mon Sep 17 00:00:00 2001
2 From: Roy Pledge <roy.pledge@nxp.com>
3 Date: Tue, 18 Feb 2020 14:02:21 -0500
4 Subject: [PATCH] sdk_qbman: Only create debugfs entries when QBMan is part of
5 device tree
6
7 Only create debugfs entries if the QBMan nodes exist in the device
8 tree.
9
10 Signed-off-by: Roy Pledge <roy.pledge@nxp.com>
11 Acked-by: Madalin Bucur <madalin.bucur@nxp.com>
12 Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
13 ---
14 drivers/staging/fsl_qbman/bman_debugfs.c | 8 +++++++-
15 drivers/staging/fsl_qbman/qman_debugfs.c | 17 ++++++++++-------
16 2 files changed, 17 insertions(+), 8 deletions(-)
17
18 --- a/drivers/staging/fsl_qbman/bman_debugfs.c
19 +++ b/drivers/staging/fsl_qbman/bman_debugfs.c
20 @@ -33,6 +33,7 @@
21 #include <linux/debugfs.h>
22 #include <linux/seq_file.h>
23 #include <linux/uaccess.h>
24 +#include <linux/of.h>
25
26 static struct dentry *dfs_root; /* debugfs root directory */
27
28 @@ -83,9 +84,14 @@ static int __init bman_debugfs_module_in
29 {
30 int ret = 0;
31 struct dentry *d;
32 + struct device_node *dn;
33
34 + dn = of_find_compatible_node(NULL, NULL, "fsl,bman");
35 + if (!dn) {
36 + pr_debug("No fsl,bman node\n");
37 + return 0;
38 + }
39 dfs_root = debugfs_create_dir("bman", NULL);
40 -
41 if (dfs_root == NULL) {
42 ret = -ENOMEM;
43 pr_err("Cannot create bman debugfs dir\n");
44 --- a/drivers/staging/fsl_qbman/qman_debugfs.c
45 +++ b/drivers/staging/fsl_qbman/qman_debugfs.c
46 @@ -1457,13 +1457,16 @@ static int __init qman_debugfs_module_in
47
48 fqid_max = 0;
49 init_ccsrmempeek();
50 - if (qman_ccsr_start) {
51 - if (!qman_ccsrmempeek(&reg, QM_FQD_AR)) {
52 - /* extract the size of the FQD window */
53 - reg = reg & 0x3f;
54 - /* calculate valid frame queue descriptor range */
55 - fqid_max = (1 << (reg + 1)) / QM_FQD_BLOCK_SIZE;
56 - }
57 + if (!qman_ccsr_start) {
58 + /* No QMan node found in device tree */
59 + return 0;
60 + }
61 +
62 + if (!qman_ccsrmempeek(&reg, QM_FQD_AR)) {
63 + /* extract the size of the FQD window */
64 + reg = reg & 0x3f;
65 + /* calculate valid frame queue descriptor range */
66 + fqid_max = (1 << (reg + 1)) / QM_FQD_BLOCK_SIZE;
67 }
68 dfs_root = debugfs_create_dir("qman", NULL);
69 fqd_root = debugfs_create_dir("fqd", dfs_root);