From: Roger Quadros <rogerq@kernel.org>
To: kishon@ti.com, vkoul@kernel.org
Cc: vigneshr@ti.com, t-patil@ti.com, sjakhade@cadence.com,
s-vadapalli@ti.com, linux-phy@lists.infradead.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
Roger Quadros <rogerq@kernel.org>
Subject: [PATCH 7/7] phy: ti: phy-j721e-wiz: set PMA_CMN_REFCLK_DIG_DIV based on reflk rate
Date: Tue, 28 Jun 2022 15:22:55 +0300 [thread overview]
Message-ID: <20220628122255.24265-8-rogerq@kernel.org> (raw)
In-Reply-To: <20220628122255.24265-1-rogerq@kernel.org>
For J7200-SR2.0 and AM64 we don't model Common refclock divider as
a clock divider as the divisor rate is fixed based on operating
reference clock frequency. We just program the recommended value
into the register. This simplifies the device tree and implementation
a lot.
Signed-off-by: Roger Quadros <rogerq@kernel.org>
---
drivers/phy/ti/phy-j721e-wiz.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/drivers/phy/ti/phy-j721e-wiz.c b/drivers/phy/ti/phy-j721e-wiz.c
index cc2ab5152f07..20af142580ad 100644
--- a/drivers/phy/ti/phy-j721e-wiz.c
+++ b/drivers/phy/ti/phy-j721e-wiz.c
@@ -24,6 +24,11 @@
#include <linux/regmap.h>
#include <linux/reset-controller.h>
+#define REF_CLK_19_2MHZ 19200000
+#define REF_CLK_25MHZ 25000000
+#define REF_CLK_100MHZ 100000000
+#define REF_CLK_156_25MHZ 156250000
+
/* SCM offsets */
#define SERDES_SUP_CTRL 0x4400
@@ -1053,6 +1058,25 @@ static int wiz_clock_init(struct wiz *wiz, struct device_node *node)
else
regmap_field_write(wiz->pma_cmn_refclk_int_mode, 0x3);
+ switch (wiz->type) {
+ case AM64_WIZ_10G:
+ case J7200_WIZ_10G:
+ switch (rate) {
+ case REF_CLK_100MHZ:
+ regmap_field_write(wiz->div_sel_field[CMN_REFCLK_DIG_DIV], 0x2);
+ break;
+ case REF_CLK_156_25MHZ:
+ regmap_field_write(wiz->div_sel_field[CMN_REFCLK_DIG_DIV], 0x3);
+ break;
+ default:
+ regmap_field_write(wiz->div_sel_field[CMN_REFCLK_DIG_DIV], 0);
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+
if (wiz->data->pma_cmn_refclk1_int_mode) {
clk = devm_clk_get(dev, "core_ref1_clk");
if (IS_ERR(clk)) {
--
2.17.1
next prev parent reply other threads:[~2022-06-28 12:23 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-28 12:22 [PATCH 0/7] phy: ti: phy-j721e-wiz: Add support for j7200-wiz-10g Roger Quadros
2022-06-28 12:22 ` [PATCH 1/7] phy: ti: phy-j721e-wiz: Add SGMII support in wiz driver for J7200 Roger Quadros
2022-06-28 12:22 ` [PATCH 2/7] dt-bindings: phy: Add PHY_TYPE_USXGMII definition Roger Quadros
2022-07-01 16:17 ` Rob Herring
2022-06-28 12:22 ` [PATCH 3/7] phy: ti: phy-j721e-wiz.c: Add usxgmii support in wiz driver Roger Quadros
2022-06-28 12:22 ` [PATCH 4/7] dt-bindings: phy: ti,phy-j721e-wiz: deprecate clock MUX nodes Roger Quadros
2022-07-01 16:18 ` Rob Herring
2022-06-28 12:22 ` [PATCH 5/7] dt-bindings: phy: ti,phy-j721e-wiz: Add support for ti,j7200-wiz-10g Roger Quadros
2022-07-01 16:19 ` Rob Herring
2022-06-28 12:22 ` [PATCH 6/7] phy: ti: phy-j721e-wiz: add support for j7200-wiz-10g Roger Quadros
2022-06-28 12:22 ` Roger Quadros [this message]
2022-08-30 5:13 ` [PATCH 0/7] phy: ti: phy-j721e-wiz: Add " Vinod Koul
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=20220628122255.24265-8-rogerq@kernel.org \
--to=rogerq@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=kishon@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=s-vadapalli@ti.com \
--cc=sjakhade@cadence.com \
--cc=t-patil@ti.com \
--cc=vigneshr@ti.com \
--cc=vkoul@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).