All of lore.kernel.org
 help / color / mirror / Atom feed
From: vincent.cheng.xh@renesas.com
To: robh+dt@kernel.org, mark.rutland@arm.com, richardcochran@gmail.com
Cc: devicetree@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Vincent Cheng <vincent.cheng.xh@renesas.com>
Subject: [PATCH net-next 3/3] ptp: clockmatrix: Rework clockmatrix version information.
Date: Tue, 17 Dec 2019 00:03:08 -0500	[thread overview]
Message-ID: <1576558988-20837-4-git-send-email-vincent.cheng.xh@renesas.com> (raw)
In-Reply-To: <1576558988-20837-1-git-send-email-vincent.cheng.xh@renesas.com>

From: Vincent Cheng <vincent.cheng.xh@renesas.com>

Remove pipeline id, bond id, csr id, and irq id.
Changes source register for reading HW rev id.
Add OTP config select.

Signed-off-by: Vincent Cheng <vincent.cheng.xh@renesas.com>
---
 drivers/ptp/ptp_clockmatrix.c | 63 ++++++++-----------------------------------
 1 file changed, 11 insertions(+), 52 deletions(-)

diff --git a/drivers/ptp/ptp_clockmatrix.c b/drivers/ptp/ptp_clockmatrix.c
index 66e3266..4ba5ea48 100644
--- a/drivers/ptp/ptp_clockmatrix.c
+++ b/drivers/ptp/ptp_clockmatrix.c
@@ -597,36 +597,7 @@ static int cm_state_machine_reset(struct cm *cm)
 
 static int cm_read_hw_rev_id(struct cm *cm, u8 *hw_rev_id)
 {
-	return cm_read(cm, GENERAL_STATUS, HW_REV_ID, hw_rev_id, sizeof(u8));
-}
-
-static int cm_read_bond_id(struct cm *cm, u8 *bond_id)
-{
-	return cm_read(cm, GENERAL_STATUS, BOND_ID, bond_id, sizeof(u8));
-}
-
-static int cm_read_hw_csr_id(struct cm *cm, u16 *hw_csr_id)
-{
-	int err;
-	u8 buf[2] = {0};
-
-	err = cm_read(cm, GENERAL_STATUS, HW_CSR_ID, buf, sizeof(buf));
-
-	*hw_csr_id = (buf[1] << 8) | buf[0];
-
-	return err;
-}
-
-static int cm_read_hw_irq_id(struct cm *cm, u16 *hw_irq_id)
-{
-	int err;
-	u8 buf[2] = {0};
-
-	err = cm_read(cm, GENERAL_STATUS, HW_IRQ_ID, buf, sizeof(buf));
-
-	*hw_irq_id = (buf[1] << 8) | buf[0];
-
-	return err;
+	return cm_read(cm, HW_REVISION, REV_ID, hw_rev_id, sizeof(u8));
 }
 
 static int cm_read_product_id(struct cm *cm, u16 *product_id)
@@ -663,16 +634,10 @@ static int cm_read_hotfix_release(struct cm *cm, u8 *hotfix)
 	return cm_read(cm, GENERAL_STATUS, HOTFIX_REL, hotfix, sizeof(u8));
 }
 
-static int cm_read_pipeline(struct cm *cm, u32 *pipeline)
+static int cm_read_otp_scsr_config_select(struct cm *cm, u8 *config_select)
 {
-	int err;
-	u8 buf[4] = {0};
-
-	err = cm_read(cm, GENERAL_STATUS, PIPELINE_ID, &buf[0], sizeof(buf));
-
-	*pipeline = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0];
-
-	return err;
+	return cm_read(cm, GENERAL_STATUS, OTP_SCSR_CONFIG_SELECT,
+		       config_select, sizeof(u8));
 }
 
 static int process_pll_mask(struct cm *cm, u32 addr, u8 val, u8 *mask)
@@ -1062,28 +1027,22 @@ static void cm_display_version_info(struct cm *cm)
 	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";
 
 	cm_read_major_release(cm, &major);
 	cm_read_minor_release(cm, &minor);
 	cm_read_hotfix_release(cm, &hotfix);
-	cm_read_pipeline(cm, &pipeline);
 
 	cm_read_product_id(cm, &product_id);
 	cm_read_hw_rev_id(cm, &hw_rev_id);
-	cm_read_bond_id(cm, &bond_id);
-	cm_read_hw_csr_id(cm, &csr_id);
-	cm_read_hw_irq_id(cm, &irq_id);
-
-	dev_info(&cm->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);
+
+	cm_read_otp_scsr_config_select(cm, &config_select);
+
+	dev_info(&cm->client->dev, fmt, major, minor, hotfix, product_id,
+		 hw_rev_id, config_select);
 }
 
 static struct ptp_clock_info cm_caps = {
-- 
2.7.4


      parent reply	other threads:[~2019-12-17  5:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-17  5:03 [PATCH net-next 0/3] Replace IDT with Renesas and improve version info vincent.cheng.xh
2019-12-17  5:03 ` [PATCH net-next 1/3] dt-bindings: ptp: Rename ptp-idtcm.yaml to ptp-cm.yaml vincent.cheng.xh
2019-12-26 19:22   ` Rob Herring
2019-12-28 17:25     ` Vincent Cheng
2019-12-17  5:03 ` [PATCH net-next 2/3] ptp: clockmatrix: Remove IDT references or replace with Renesas vincent.cheng.xh
2019-12-18  6:29   ` David Miller
2019-12-18 14:45     ` Vincent Cheng
2019-12-18 20:23       ` David Miller
2019-12-17  5:03 ` vincent.cheng.xh [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1576558988-20837-4-git-send-email-vincent.cheng.xh@renesas.com \
    --to=vincent.cheng.xh@renesas.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=netdev@vger.kernel.org \
    --cc=richardcochran@gmail.com \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.