2020-01-06 19:13:04

by Vincent Cheng

[permalink] [raw]
Subject: [PATCH v3 net-next 0/1] Replace IDT with Renesas and improve version info.

From: Vincent Cheng <[email protected]>

Replacing IDT with Renesas patches has been withdrawn.
This series reworks the version info displayed for the clockmatrix chip.

Apologize for the delayed response to Dec 20 feedback.
Corporate email server hiccup so email was not received.
Added more details to Patch 1/1 commit message to explain the change.

Fixes: 3a6ba7dc7799 ("ptp: Add a ptp clock driver for IDT ClockMatrix.")

Changes since v2:
- Add details to commit message for Patch 1 to provide
background information.

Changes since v1:
- Remove Patch 1/3 Add Replace idt with renesas in dt-bindings
- Remove Patch 2/3 Replaces IDT references with Renesas
- Patch 3/3 becomes patch 1/1

Vincent Cheng (1):
ptp: clockmatrix: Rework clockmatrix version information.

drivers/ptp/ptp_clockmatrix.c | 77 ++++++++-----------------------------------
1 file changed, 13 insertions(+), 64 deletions(-)

--
2.7.4


2020-01-06 19:14:22

by Vincent Cheng

[permalink] [raw]
Subject: [PATCH v3 net-next 1/1] ptp: clockmatrix: Rework clockmatrix version information.

From: Vincent Cheng <[email protected]>

Simplify and fix the version information displayed by the driver.
The new info better relects what is needed to support the hardware.

Prev:
Version: 4.8.0, Pipeline 22169 0x4001, Rev 0, Bond 5, CSR 311, IRQ 2

New:
Version: 4.8.0, Id: 0x4001 Hw Rev: 5 OTP Config Select: 15

- Removed pipeline, CSR and IRQ because version x.y.z already incorporates
this information.
- Removed bond number because it is not used.
- Removed rev number because register was not implemented, always 0
- Add HW Rev ID register to replace rev number
- Add OTP config select to show the user configuration chosen by
the configurable GPIO pins on start-up

Signed-off-by: Vincent Cheng <[email protected]>
---
drivers/ptp/ptp_clockmatrix.c | 77 ++++++++-----------------------------------
1 file changed, 13 insertions(+), 64 deletions(-)

diff --git a/drivers/ptp/ptp_clockmatrix.c b/drivers/ptp/ptp_clockmatrix.c
index e858367..032e112 100644
--- a/drivers/ptp/ptp_clockmatrix.c
+++ b/drivers/ptp/ptp_clockmatrix.c
@@ -405,6 +405,7 @@ static int _idtcm_set_dpll_tod(struct idtcm_channel *channel,
if (wr_trig == HW_TOD_WR_TRIG_SEL_MSB) {

if (idtcm->calculate_overhead_flag) {
+ /* Assumption: I2C @ 400KHz */
total_overhead_ns = ktime_to_ns(ktime_get_raw()
- idtcm->start_time)
+ idtcm->tod_write_overhead_ns
@@ -596,44 +597,7 @@ static int idtcm_state_machine_reset(struct idtcm *idtcm)

static int idtcm_read_hw_rev_id(struct idtcm *idtcm, u8 *hw_rev_id)
{
- return idtcm_read(idtcm,
- GENERAL_STATUS,
- HW_REV_ID,
- hw_rev_id,
- sizeof(u8));
-}
-
-static int idtcm_read_bond_id(struct idtcm *idtcm, u8 *bond_id)
-{
- return idtcm_read(idtcm,
- GENERAL_STATUS,
- BOND_ID,
- bond_id,
- sizeof(u8));
-}
-
-static int idtcm_read_hw_csr_id(struct idtcm *idtcm, u16 *hw_csr_id)
-{
- int err;
- u8 buf[2] = {0};
-
- err = idtcm_read(idtcm, GENERAL_STATUS, HW_CSR_ID, buf, sizeof(buf));
-
- *hw_csr_id = (buf[1] << 8) | buf[0];
-
- return err;
-}
-
-static int idtcm_read_hw_irq_id(struct idtcm *idtcm, u16 *hw_irq_id)
-{
- int err;
- u8 buf[2] = {0};
-
- err = idtcm_read(idtcm, GENERAL_STATUS, HW_IRQ_ID, buf, sizeof(buf));
-
- *hw_irq_id = (buf[1] << 8) | buf[0];
-
- return err;
+ return idtcm_read(idtcm, HW_REVISION, REV_ID, hw_rev_id, sizeof(u8));
}

static int idtcm_read_product_id(struct idtcm *idtcm, u16 *product_id)
@@ -674,20 +638,11 @@ static int idtcm_read_hotfix_release(struct idtcm *idtcm, u8 *hotfix)
sizeof(u8));
}

-static int idtcm_read_pipeline(struct idtcm *idtcm, u32 *pipeline)
+static int idtcm_read_otp_scsr_config_select(struct idtcm *idtcm,
+ u8 *config_select)
{
- int err;
- u8 buf[4] = {0};
-
- err = idtcm_read(idtcm,
- GENERAL_STATUS,
- PIPELINE_ID,
- &buf[0],
- sizeof(buf));
-
- *pipeline = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0];
-
- return err;
+ return idtcm_read(idtcm, GENERAL_STATUS, OTP_SCSR_CONFIG_SELECT,
+ config_select, sizeof(u8));
}

static int process_pll_mask(struct idtcm *idtcm, u32 addr, u8 val, u8 *mask)
@@ -1078,28 +1033,22 @@ static void idtcm_display_version_info(struct idtcm *idtcm)
u8 major;
u8 minor;
u8 hotfix;
- u32 pipeline;
u16 product_id;
- u16 csr_id;
- u16 irq_id;
u8 hw_rev_id;
- u8 bond_id;
+ u8 config_select;
+ char *fmt = "%d.%d.%d, Id: 0x%04x HW Rev: %d OTP Config Select: %d\n";

idtcm_read_major_release(idtcm, &major);
idtcm_read_minor_release(idtcm, &minor);
idtcm_read_hotfix_release(idtcm, &hotfix);
- idtcm_read_pipeline(idtcm, &pipeline);

idtcm_read_product_id(idtcm, &product_id);
idtcm_read_hw_rev_id(idtcm, &hw_rev_id);
- idtcm_read_bond_id(idtcm, &bond_id);
- idtcm_read_hw_csr_id(idtcm, &csr_id);
- idtcm_read_hw_irq_id(idtcm, &irq_id);
-
- dev_info(&idtcm->client->dev, "Version: %d.%d.%d, Pipeline %u\t"
- "0x%04x, Rev %d, Bond %d, CSR %d, IRQ %d\n",
- major, minor, hotfix, pipeline,
- product_id, hw_rev_id, bond_id, csr_id, irq_id);
+
+ idtcm_read_otp_scsr_config_select(idtcm, &config_select);
+
+ dev_info(&idtcm->client->dev, fmt, major, minor, hotfix,
+ product_id, hw_rev_id, config_select);
}

static const struct ptp_clock_info idtcm_caps = {
--
2.7.4

2020-01-07 02:04:51

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v3 net-next 1/1] ptp: clockmatrix: Rework clockmatrix version information.

Hi,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on net-next/master]
[also build test ERROR on net/master linus/master v5.5-rc5 next-20200106]
[cannot apply to ipvs/master]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/vincent-cheng-xh-renesas-com/Replace-IDT-with-Renesas-and-improve-version-info/20200107-052817
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 4460985fac06f8e0e5bd4b86dcef49ada451583c
config: x86_64-randconfig-g002-20200106 (attached as .config)
compiler: gcc-7 (Debian 7.5.0-3) 7.5.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <[email protected]>

All error/warnings (new ones prefixed by >>):

drivers//ptp/ptp_clockmatrix.c: In function 'idtcm_read_otp_scsr_config_select':
>> drivers//ptp/ptp_clockmatrix.c:644:43: error: 'OTP_SCSR_CONFIG_SELECT' undeclared (first use in this function); did you mean 'PTP_SYS_OFFSET'?
return idtcm_read(idtcm, GENERAL_STATUS, OTP_SCSR_CONFIG_SELECT,
^~~~~~~~~~~~~~~~~~~~~~
PTP_SYS_OFFSET
drivers//ptp/ptp_clockmatrix.c:644:43: note: each undeclared identifier is reported only once for each function it appears in
>> drivers//ptp/ptp_clockmatrix.c:646:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^

vim +644 drivers//ptp/ptp_clockmatrix.c

640
641 static int idtcm_read_otp_scsr_config_select(struct idtcm *idtcm,
642 u8 *config_select)
643 {
> 644 return idtcm_read(idtcm, GENERAL_STATUS, OTP_SCSR_CONFIG_SELECT,
645 config_select, sizeof(u8));
> 646 }
647

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/[email protected] Intel Corporation


Attachments:
(No filename) (2.17 kB)
.config.gz (33.25 kB)
Download all attachments