Skip to content
Snippets Groups Projects
Commit 7737bc78 authored by Wu, Qiming's avatar Wu, Qiming Committed by Kenneth Johansson
Browse files

Merge pull request #256 in SW_PON/linux from UGW_SW-22356-add-CBM-init-debug-messages to xrx500

* commit '184e9bc950922c1aa2f1bd5347d73a8ad7d27cbe':
  Add debug messages to CQM init
parent 805dff8e
No related branches found
No related tags found
No related merge requests found
#include "cqm_dev.h"
#define CQM_NUM_DEV_SUPP 2
......@@ -28,7 +27,9 @@ struct device_node *parse_dts(int j, void **pdata, struct resource **res,
node = of_find_node_by_name(NULL, dev_node_name[j].node_name);
if (!node) {
/*pr_err("Unable to get %s\n", dev_node_name[j].node_name);*/
pr_err("Unable to get node %s for %s\n",
dev_node_name[j].node_name,
dev_node_name[j].dev_name);
return NULL;
}
*pdata = kzalloc(sizeof(*cqm_pdata), GFP_KERNEL);
......@@ -62,7 +63,7 @@ struct device_node *parse_dts(int j, void **pdata, struct resource **res,
memcpy(cqm_pdata->intrs, intr, (sizeof(unsigned int) * idx));
cqm_pdata->rcu_reset = of_reset_control_get(node, "cqm");
if (IS_ERR(cqm_pdata->rcu_reset)) {
pr_err("Error in getting rcu reset\n");
pr_err("No rcu reset for %s\n", dev_node_name[j].node_name);
/*return PTR_ERR(cqm_pdata->rcu_reset)*/;
}
......@@ -96,17 +97,17 @@ int add_cqm_dev(int i)
node = parse_dts(i, &pdata, &res, &num_res);
if (!node) {
/*pr_err("%s(#%d): parse_dts fail\n",
*__func__, __LINE__);
*/
pr_err("%s(#%d): parse_dts fail for %s\n",
__func__, __LINE__, dev_node_name[i].dev_name);
return CBM_FAILURE;
}
pr_info("parse dts done\n");
#if 1
pdev = platform_device_alloc(dev_node_name[i].dev_name, 1);
if (!pdev) {
pr_err("%s(#%d): platform_device_alloc fail\n",
__func__, __LINE__);
pr_err("%s(#%d): platform_device_alloc fail for %s\n",
__func__, __LINE__, dev_node_name[i].node_name);
return -ENOMEM;
}
......@@ -120,17 +121,18 @@ int add_cqm_dev(int i)
pr_info("adding resources\n");
ret = platform_device_add_resources(pdev, res, num_res);
if (ret) {
pr_info("%s: Failed to add resources.\n",
__func__);
pr_info("%s: Failed to add resources for %s.\n",
__func__, dev_node_name[i].node_name);
goto err_free_pdata;
}
}
pr_info("resources added\n");
/* Add platform device */
ret = platform_device_add(pdev);
if (ret) {
pr_info("%s: Failed to add platform device.\n",
__func__);
pr_info("%s: Failed to add platform device for %s.\n",
__func__, dev_node_name[i].node_name);
goto err_free_pdata;
}
#endif
......@@ -160,8 +162,11 @@ static int cqm_platdev_parse_dts(void)
int i, dev_add = 0;
for (i = 0; i < CQM_NUM_DEV_SUPP; i++) {
if (!add_cqm_dev(i))
pr_info("dev %s\n", dev_node_name[i].dev_name);
if (!add_cqm_dev(i)) {
dev_add++;
pr_info("device added\n");
}
}
if (!dev_add)
pr_err("Not Even 1 CBM device registered\n");
......@@ -170,6 +175,7 @@ static int cqm_platdev_parse_dts(void)
static __init int cqm_platdev_init(void)
{
pr_info("%s is called\n", __func__);
cqm_platdev_parse_dts();
return 0;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment