[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <OSAPR01MB1780733AA3B25A528A76F8F2BA020@OSAPR01MB1780.jpnprd01.prod.outlook.com>
Date: Thu, 15 Oct 2020 19:30:46 +0000
From: Min Li <min.li.xe@...esas.com>
To: Min Li <min.li.xe@...esas.com>,
"richardcochran@...il.com" <richardcochran@...il.com>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH net 2/4] ptp: ptp_idt82p33: add more debug logs
Hi David/Richard
When you have time, can you take a look at this change? Thanks
Min
-----Original Message-----
From: min.li.xe@...esas.com <min.li.xe@...esas.com>
Sent: August 7, 2020 11:58 AM
To: richardcochran@...il.com
Cc: netdev@...r.kernel.org; linux-kernel@...r.kernel.org; Min Li <min.li.xe@...esas.com>
Subject: [PATCH net 2/4] ptp: ptp_idt82p33: add more debug logs
From: Min Li <min.li.xe@...esas.com>
Signed-off-by: Min Li <min.li.xe@...esas.com>
---
drivers/ptp/ptp_idt82p33.c | 88 +++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 79 insertions(+), 9 deletions(-)
diff --git a/drivers/ptp/ptp_idt82p33.c b/drivers/ptp/ptp_idt82p33.c index bd1fbcd..189bb81 100644
--- a/drivers/ptp/ptp_idt82p33.c
+++ b/drivers/ptp/ptp_idt82p33.c
@@ -86,6 +86,7 @@ static int idt82p33_xfer(struct idt82p33 *idt82p33,
struct i2c_client *client = idt82p33->client;
struct i2c_msg msg[2];
int cnt;
+ char *fmt = "i2c_transfer failed at %d in %s for %s, at addr:
+%04X!\n";
msg[0].addr = client->addr;
msg[0].flags = 0;
@@ -99,7 +100,12 @@ static int idt82p33_xfer(struct idt82p33 *idt82p33,
cnt = i2c_transfer(client->adapter, msg, 2);
if (cnt < 0) {
- dev_err(&client->dev, "i2c_transfer returned %d\n", cnt);
+ dev_err(&client->dev,
+ fmt,
+ __LINE__,
+ __func__,
+ write ? "write" : "read",
+ (u8) regaddr);
return cnt;
} else if (cnt != 2) {
dev_err(&client->dev,
@@ -448,8 +454,13 @@ static int idt82p33_measure_tod_write_overhead(struct idt82p33_channel *channel)
err = idt82p33_measure_settime_gettime_gap_overhead(channel, &gap_ns);
- if (err)
+ if (err) {
+ dev_err(&idt82p33->client->dev,
+ "Failed at line %d in func %s!\n",
+ __LINE__,
+ __func__);
return err;
+ }
err = idt82p33_measure_one_byte_write_overhead(channel,
&one_byte_write_ns);
@@ -613,13 +624,23 @@ static int idt82p33_enable_tod(struct idt82p33_channel *channel)
err = idt82p33_pps_enable(channel, false);
- if (err)
+ if (err) {
+ dev_err(&idt82p33->client->dev,
+ "Failed at line %d in func %s!\n",
+ __LINE__,
+ __func__);
return err;
+ }
err = idt82p33_measure_tod_write_overhead(channel);
- if (err)
+ if (err) {
+ dev_err(&idt82p33->client->dev,
+ "Failed at line %d in func %s!\n",
+ __LINE__,
+ __func__);
return err;
+ }
err = _idt82p33_settime(channel, &ts);
@@ -728,6 +749,11 @@ static int idt82p33_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
mutex_lock(&idt82p33->reg_lock);
err = _idt82p33_adjfine(channel, scaled_ppm);
+ if (err)
+ dev_err(&idt82p33->client->dev,
+ "Failed at line %d in func %s!\n",
+ __LINE__,
+ __func__);
mutex_unlock(&idt82p33->reg_lock);
return err;
@@ -751,10 +777,19 @@ static int idt82p33_adjtime(struct ptp_clock_info *ptp, s64 delta_ns)
if (err) {
mutex_unlock(&idt82p33->reg_lock);
+ dev_err(&idt82p33->client->dev,
+ "Failed at line %d in func %s!\n",
+ __LINE__,
+ __func__);
return err;
}
err = idt82p33_sync_tod(channel, true);
+ if (err)
+ dev_err(&idt82p33->client->dev,
+ "Failed at line %d in func %s!\n",
+ __LINE__,
+ __func__);
mutex_unlock(&idt82p33->reg_lock);
@@ -770,6 +805,11 @@ static int idt82p33_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts)
mutex_lock(&idt82p33->reg_lock);
err = _idt82p33_gettime(channel, ts);
+ if (err)
+ dev_err(&idt82p33->client->dev,
+ "Failed at line %d in func %s!\n",
+ __LINE__,
+ __func__);
mutex_unlock(&idt82p33->reg_lock);
return err;
@@ -785,6 +825,11 @@ static int idt82p33_settime(struct ptp_clock_info *ptp,
mutex_lock(&idt82p33->reg_lock);
err = _idt82p33_settime(channel, ts);
+ if (err)
+ dev_err(&idt82p33->client->dev,
+ "Failed at line %d in func %s!\n",
+ __LINE__,
+ __func__);
mutex_unlock(&idt82p33->reg_lock);
return err;
@@ -849,8 +894,13 @@ static int idt82p33_enable_channel(struct idt82p33 *idt82p33, u32 index)
channel = &idt82p33->channel[index];
err = idt82p33_channel_init(channel, index);
- if (err)
+ if (err) {
+ dev_err(&idt82p33->client->dev,
+ "Failed at line %d in func %s!\n",
+ __LINE__,
+ __func__);
return err;
+ }
channel->idt82p33 = idt82p33;
@@ -859,12 +909,22 @@ static int idt82p33_enable_channel(struct idt82p33 *idt82p33, u32 index)
"IDT 82P33 PLL%u", index);
err = idt82p33_dpll_set_mode(channel, PLL_MODE_DCO);
- if (err)
+ if (err) {
+ dev_err(&idt82p33->client->dev,
+ "Failed at line %d in func %s!\n",
+ __LINE__,
+ __func__);
return err;
+ }
err = idt82p33_enable_tod(channel);
- if (err)
+ if (err) {
+ dev_err(&idt82p33->client->dev,
+ "Failed at line %d in func %s!\n",
+ __LINE__,
+ __func__);
return err;
+ }
channel->ptp_clock = ptp_clock_register(&channel->caps, NULL);
@@ -896,8 +956,13 @@ static int idt82p33_load_firmware(struct idt82p33 *idt82p33)
err = request_firmware(&fw, FW_FILENAME, &idt82p33->client->dev);
- if (err)
+ if (err) {
+ dev_err(&idt82p33->client->dev,
+ "Failed at line %d in func %s!\n",
+ __LINE__,
+ __func__);
return err;
+ }
dev_dbg(&idt82p33->client->dev, "firmware size %zu bytes\n", fw->size);
@@ -981,8 +1046,13 @@ static int idt82p33_probe(struct i2c_client *client,
for (i = 0; i < MAX_PHC_PLL; i++) {
if (idt82p33->pll_mask & (1 << i)) {
err = idt82p33_enable_channel(idt82p33, i);
- if (err)
+ if (err) {
+ dev_err(&idt82p33->client->dev,
+ "Failed at %d in func %s!\n",
+ __LINE__,
+ __func__);
break;
+ }
}
}
} else {
--
2.7.4
Powered by blists - more mailing lists