[PATCH] add just for debug, this patch will be removed from the upstream version 5 submission

From: Richard Gong
Date: Wed May 29 2019 - 16:51:45 EST


Signed-off-by: Richard Gong <richard.gong@xxxxxxxxx>
---
drivers/firmware/stratix10-rsu.c | 42 ++++++++++++++++++++++++++++++++++++++--
1 file changed, 40 insertions(+), 2 deletions(-)

diff --git a/drivers/firmware/stratix10-rsu.c b/drivers/firmware/stratix10-rsu.c
index 8028d0d..c868d97 100644
--- a/drivers/firmware/stratix10-rsu.c
+++ b/drivers/firmware/stratix10-rsu.c
@@ -23,6 +23,13 @@

#define RSU_TIMEOUT (msecs_to_jiffies(SVC_RSU_REQUEST_TIMEOUT_MS))

+/*
+ * for debug purpose:
+ * set the global variable to make sure data is
+ * data is correct with cat command
+ */
+//static int currentImage = 0;
+
typedef void (*rsu_callback)(struct stratix10_svc_client *client,
struct stratix10_svc_cb_data *data);

@@ -69,6 +76,14 @@ static void rsu_status_callback(struct stratix10_svc_client *client,
struct stratix10_rsu_priv *priv = client->priv;
struct arm_smccc_res *res = (struct arm_smccc_res *)data->kaddr1;

+ /* for debug purpose */
+ printk("*** %s: \n", __func__);
+ printk("res->a1=%lx\n", res->a0);
+ printk("res->a1=%lx\n", res->a1);
+ printk("res->a2=%lx\n", res->a2);
+ printk("res->a3=%lx\n", res->a3);
+ printk("priv=%pf\n", priv);
+
if (data->status == BIT(SVC_STATUS_RSU_OK)) {
priv->status.version = FIELD_GET(RSU_VERSION_MASK,
res->a2);
@@ -79,6 +94,15 @@ static void rsu_status_callback(struct stratix10_svc_client *client,
FIELD_GET(RSU_ERROR_LOCATION_MASK, res->a3);
priv->status.error_details =
FIELD_GET(RSU_ERROR_DETAIL_MASK, res->a3);
+
+ /* for debug purpose */
+ printk("version=%lx\, state=%lx, current_image=%lx, fail_image=%lx, error_location=%lx, error_details=%lx\n",
+ priv->status.version, priv->status.state, priv->status.current_image, priv->status.fail_image,
+ priv->status.error_location, priv->status.error_details);
+
+ /* for debug purpose */
+ //currentImage = res->a0;
+
} else {
dev_err(client->dev, "COMMAND_RSU_STATUS returned 0x%lX\n",
res->a0);
@@ -177,9 +201,12 @@ static ssize_t current_image_show(struct device *dev,
{
struct stratix10_rsu_priv *priv = dev_get_drvdata(dev);

+ printk("*** %s: priv=%pf\n", __func__, priv);
if (!priv)
return -ENODEV;

+ /* for debug purpose */
+ //return sprintf(buf, "%ld", currentImage);
return sprintf(buf, "%ld", priv->status.current_image);
}

@@ -368,7 +395,6 @@ static int stratix10_rsu_probe(struct platform_device *pdev)
}

init_completion(&priv->completion);
- platform_set_drvdata(pdev, priv);

/* status is only updated after reboot */
ret = rsu_send_msg(priv, COMMAND_RSU_STATUS,
@@ -378,6 +404,18 @@ static int stratix10_rsu_probe(struct platform_device *pdev)
stratix10_svc_free_channel(priv->chan);
}

+#if 1
+ /* data will be correct if use devm_device_add_groups()*/
+ ret = devm_device_add_groups(dev, rsu_groups);
+ if (ret) {
+ dev_err(dev, "unable to create sysfs group");
+ stratix10_svc_free_channel(priv->chan);
+ }
+#endif
+
+ printk("*** %s: priv=%pf\n", __func__, priv);
+ platform_set_drvdata(pdev, priv);
+
return ret;
}

@@ -394,7 +432,7 @@ static struct platform_driver stratix10_rsu_driver = {
.remove = stratix10_rsu_remove,
.driver = {
.name = "stratix10-rsu",
- .groups = rsu_groups,
+// .groups = rsu_groups,
},
};

--
2.7.4


--------------58DC67A8AB4E5FBBD2CB2F4D--