linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 1/4] dt-bindings: clk: rs9: Add 9FGV0841
@ 2023-11-13 22:18 Marek Vasut
  2023-11-13 22:18 ` [PATCH v3 2/4] clk: rs9: Limit check to vendor ID in VID register Marek Vasut
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Marek Vasut @ 2023-11-13 22:18 UTC (permalink / raw)
  To: linux-clk
  Cc: Marek Vasut, Alexander Stein, Conor Dooley, Conor Dooley,
	Geert Uytterhoeven, Krzysztof Kozlowski, Michael Turquette,
	Rob Herring, Stephen Boyd, devicetree, linux-renesas-soc

This is an 8-channel variant of 9FGV series.

Acked-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
---
Cc: Alexander Stein <alexander.stein@ew.tq-group.com>
Cc: Conor Dooley <conor+dt@kernel.org>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: devicetree@vger.kernel.org
Cc: linux-clk@vger.kernel.org
Cc: linux-renesas-soc@vger.kernel.org
---
V2: Add AB from Alexander and Conor
V3: No change
---
 .../devicetree/bindings/clock/renesas,9series.yaml     | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/Documentation/devicetree/bindings/clock/renesas,9series.yaml b/Documentation/devicetree/bindings/clock/renesas,9series.yaml
index 3afdebdb52ad..af6319697b1c 100644
--- a/Documentation/devicetree/bindings/clock/renesas,9series.yaml
+++ b/Documentation/devicetree/bindings/clock/renesas,9series.yaml
@@ -21,6 +21,15 @@ description: |
     1 -- DIF1
     2 -- DIF2
     3 -- DIF3
+  - 9FGV0841:
+    0 -- DIF0
+    1 -- DIF1
+    2 -- DIF2
+    3 -- DIF3
+    4 -- DIF4
+    5 -- DIF5
+    6 -- DIF6
+    7 -- DIF7
 
 maintainers:
   - Marek Vasut <marex@denx.de>
@@ -30,6 +39,7 @@ properties:
     enum:
       - renesas,9fgv0241
       - renesas,9fgv0441
+      - renesas,9fgv0841
 
   reg:
     description: I2C device address
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v3 2/4] clk: rs9: Limit check to vendor ID in VID register
  2023-11-13 22:18 [PATCH v3 1/4] dt-bindings: clk: rs9: Add 9FGV0841 Marek Vasut
@ 2023-11-13 22:18 ` Marek Vasut
  2023-12-17 23:28   ` Stephen Boyd
  2023-11-13 22:18 ` [PATCH v3 3/4] clk: rs9: Replace model check with bitshift from chip data Marek Vasut
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Marek Vasut @ 2023-11-13 22:18 UTC (permalink / raw)
  To: linux-clk
  Cc: Marek Vasut, Biju Das, Alexander Stein, Conor Dooley,
	Geert Uytterhoeven, Krzysztof Kozlowski, Michael Turquette,
	Rob Herring, Stephen Boyd, devicetree, linux-renesas-soc

Extract only vendor ID from VID register, the top 4 bits are
revision ID which are not useful for the vendor ID check.

Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
---
Cc: Alexander Stein <alexander.stein@ew.tq-group.com>
Cc: Conor Dooley <conor+dt@kernel.org>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: devicetree@vger.kernel.org
Cc: linux-clk@vger.kernel.org
Cc: linux-renesas-soc@vger.kernel.org
---
V2: Split off patch from 4/4
V3: Add RB from Biju
---
 drivers/clk/clk-renesas-pcie.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/clk-renesas-pcie.c b/drivers/clk/clk-renesas-pcie.c
index 6606aba253c5..b5c430e4899c 100644
--- a/drivers/clk/clk-renesas-pcie.c
+++ b/drivers/clk/clk-renesas-pcie.c
@@ -42,6 +42,7 @@
 #define RS9_REG_DID				0x6
 #define RS9_REG_BCP				0x7
 
+#define RS9_REG_VID_MASK			GENMASK(3, 0)
 #define RS9_REG_VID_IDT				0x01
 
 #define RS9_REG_DID_TYPE_FGV			(0x0 << RS9_REG_DID_TYPE_SHIFT)
@@ -333,6 +334,7 @@ static int rs9_probe(struct i2c_client *client)
 	if (ret < 0)
 		return ret;
 
+	vid &= RS9_REG_VID_MASK;
 	if (vid != RS9_REG_VID_IDT || did != rs9->chip_info->did)
 		return dev_err_probe(&client->dev, -ENODEV,
 				     "Incorrect VID/DID: %#02x, %#02x. Expected %#02x, %#02x\n",
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v3 3/4] clk: rs9: Replace model check with bitshift from chip data
  2023-11-13 22:18 [PATCH v3 1/4] dt-bindings: clk: rs9: Add 9FGV0841 Marek Vasut
  2023-11-13 22:18 ` [PATCH v3 2/4] clk: rs9: Limit check to vendor ID in VID register Marek Vasut
@ 2023-11-13 22:18 ` Marek Vasut
  2023-12-17 23:28   ` Stephen Boyd
  2023-11-13 22:18 ` [PATCH v3 4/4] clk: rs9: Add support for 9FGV0841 Marek Vasut
  2023-12-17 23:28 ` [PATCH v3 1/4] dt-bindings: clk: rs9: Add 9FGV0841 Stephen Boyd
  3 siblings, 1 reply; 8+ messages in thread
From: Marek Vasut @ 2023-11-13 22:18 UTC (permalink / raw)
  To: linux-clk
  Cc: Marek Vasut, Alexander Stein, Conor Dooley, Geert Uytterhoeven,
	Krzysztof Kozlowski, Michael Turquette, Rob Herring,
	Stephen Boyd, devicetree, linux-renesas-soc

Adjust rs9_calc_dif() to special-case the 9FGV0241 where DIFx bits
start at 1, encode this shift into chip data and drop the model
check entirely.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
---
Cc: Alexander Stein <alexander.stein@ew.tq-group.com>
Cc: Conor Dooley <conor+dt@kernel.org>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: devicetree@vger.kernel.org
Cc: linux-clk@vger.kernel.org
Cc: linux-renesas-soc@vger.kernel.org
---
V2: New patch
V3: Drop enum rs9_model
---
 drivers/clk/clk-renesas-pcie.c | 26 +++++++++-----------------
 1 file changed, 9 insertions(+), 17 deletions(-)

diff --git a/drivers/clk/clk-renesas-pcie.c b/drivers/clk/clk-renesas-pcie.c
index b5c430e4899c..e86c2911ceb4 100644
--- a/drivers/clk/clk-renesas-pcie.c
+++ b/drivers/clk/clk-renesas-pcie.c
@@ -50,16 +50,10 @@
 #define RS9_REG_DID_TYPE_DMV			(0x2 << RS9_REG_DID_TYPE_SHIFT)
 #define RS9_REG_DID_TYPE_SHIFT			0x6
 
-/* Supported Renesas 9-series models. */
-enum rs9_model {
-	RENESAS_9FGV0241,
-	RENESAS_9FGV0441,
-};
-
 /* Structure to describe features of a particular 9-series model */
 struct rs9_chip_info {
-	const enum rs9_model	model;
 	unsigned int		num_clks;
+	u8			outshift;
 	u8			did;
 };
 
@@ -161,14 +155,12 @@ static const struct regmap_config rs9_regmap_config = {
 
 static u8 rs9_calc_dif(const struct rs9_driver_data *rs9, int idx)
 {
-	enum rs9_model model = rs9->chip_info->model;
-
-	if (model == RENESAS_9FGV0241)
-		return BIT(idx + 1);
-	else if (model == RENESAS_9FGV0441)
-		return BIT(idx);
-
-	return 0;
+	/*
+	 * On 9FGV0241, the DIF OE0 is BIT(1) and DIF OE(1) is BIT(2),
+	 * on 9FGV0441 and 9FGV0841 the DIF OE0 is BIT(0) and so on.
+	 * Increment the index in the 9FGV0241 special case here.
+	 */
+	return BIT(idx + rs9->chip_info->outshift);
 }
 
 static int rs9_get_output_config(struct rs9_driver_data *rs9, int idx)
@@ -382,14 +374,14 @@ static int __maybe_unused rs9_resume(struct device *dev)
 }
 
 static const struct rs9_chip_info renesas_9fgv0241_info = {
-	.model		= RENESAS_9FGV0241,
 	.num_clks	= 2,
+	.outshift	= 1,
 	.did		= RS9_REG_DID_TYPE_FGV | 0x02,
 };
 
 static const struct rs9_chip_info renesas_9fgv0441_info = {
-	.model		= RENESAS_9FGV0441,
 	.num_clks	= 4,
+	.outshift	= 0,
 	.did		= RS9_REG_DID_TYPE_FGV | 0x04,
 };
 
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v3 4/4] clk: rs9: Add support for 9FGV0841
  2023-11-13 22:18 [PATCH v3 1/4] dt-bindings: clk: rs9: Add 9FGV0841 Marek Vasut
  2023-11-13 22:18 ` [PATCH v3 2/4] clk: rs9: Limit check to vendor ID in VID register Marek Vasut
  2023-11-13 22:18 ` [PATCH v3 3/4] clk: rs9: Replace model check with bitshift from chip data Marek Vasut
@ 2023-11-13 22:18 ` Marek Vasut
  2023-12-17 23:29   ` Stephen Boyd
  2023-12-17 23:28 ` [PATCH v3 1/4] dt-bindings: clk: rs9: Add 9FGV0841 Stephen Boyd
  3 siblings, 1 reply; 8+ messages in thread
From: Marek Vasut @ 2023-11-13 22:18 UTC (permalink / raw)
  To: linux-clk
  Cc: Marek Vasut, Biju Das, Alexander Stein, Conor Dooley,
	Geert Uytterhoeven, Krzysztof Kozlowski, Michael Turquette,
	Rob Herring, Stephen Boyd, devicetree, linux-renesas-soc

This model is similar to 9FGV0441, the DIFx bits start at bit 0 again,
except this chip has 8 outputs.

Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
---
Cc: Alexander Stein <alexander.stein@ew.tq-group.com>
Cc: Conor Dooley <conor+dt@kernel.org>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: devicetree@vger.kernel.org
Cc: linux-clk@vger.kernel.org
Cc: linux-renesas-soc@vger.kernel.org
---
V2: Update on top of 2/4 and 3/4
V3: - Update on top of 3/4
    - Add RB from Biju
---
 drivers/clk/clk-renesas-pcie.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/clk/clk-renesas-pcie.c b/drivers/clk/clk-renesas-pcie.c
index e86c2911ceb4..53e21ac302e6 100644
--- a/drivers/clk/clk-renesas-pcie.c
+++ b/drivers/clk/clk-renesas-pcie.c
@@ -7,6 +7,7 @@
  * Currently supported:
  *   - 9FGV0241
  *   - 9FGV0441
+ *   - 9FGV0841
  *
  * Copyright (C) 2022 Marek Vasut <marex@denx.de>
  */
@@ -385,9 +386,16 @@ static const struct rs9_chip_info renesas_9fgv0441_info = {
 	.did		= RS9_REG_DID_TYPE_FGV | 0x04,
 };
 
+static const struct rs9_chip_info renesas_9fgv0841_info = {
+	.num_clks	= 8,
+	.outshift	= 0,
+	.did		= RS9_REG_DID_TYPE_FGV | 0x08,
+};
+
 static const struct i2c_device_id rs9_id[] = {
 	{ "9fgv0241", .driver_data = (kernel_ulong_t)&renesas_9fgv0241_info },
 	{ "9fgv0441", .driver_data = (kernel_ulong_t)&renesas_9fgv0441_info },
+	{ "9fgv0841", .driver_data = (kernel_ulong_t)&renesas_9fgv0841_info },
 	{ }
 };
 MODULE_DEVICE_TABLE(i2c, rs9_id);
@@ -395,6 +403,7 @@ MODULE_DEVICE_TABLE(i2c, rs9_id);
 static const struct of_device_id clk_rs9_of_match[] = {
 	{ .compatible = "renesas,9fgv0241", .data = &renesas_9fgv0241_info },
 	{ .compatible = "renesas,9fgv0441", .data = &renesas_9fgv0441_info },
+	{ .compatible = "renesas,9fgv0841", .data = &renesas_9fgv0841_info },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, clk_rs9_of_match);
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 1/4] dt-bindings: clk: rs9: Add 9FGV0841
  2023-11-13 22:18 [PATCH v3 1/4] dt-bindings: clk: rs9: Add 9FGV0841 Marek Vasut
                   ` (2 preceding siblings ...)
  2023-11-13 22:18 ` [PATCH v3 4/4] clk: rs9: Add support for 9FGV0841 Marek Vasut
@ 2023-12-17 23:28 ` Stephen Boyd
  3 siblings, 0 replies; 8+ messages in thread
From: Stephen Boyd @ 2023-12-17 23:28 UTC (permalink / raw)
  To: Marek Vasut, linux-clk
  Cc: Marek Vasut, Alexander Stein, Conor Dooley, Conor Dooley,
	Geert Uytterhoeven, Krzysztof Kozlowski, Michael Turquette,
	Rob Herring, devicetree, linux-renesas-soc

Quoting Marek Vasut (2023-11-13 14:18:51)
> This is an 8-channel variant of 9FGV series.
> 
> Acked-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> Acked-by: Conor Dooley <conor.dooley@microchip.com>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 2/4] clk: rs9: Limit check to vendor ID in VID register
  2023-11-13 22:18 ` [PATCH v3 2/4] clk: rs9: Limit check to vendor ID in VID register Marek Vasut
@ 2023-12-17 23:28   ` Stephen Boyd
  0 siblings, 0 replies; 8+ messages in thread
From: Stephen Boyd @ 2023-12-17 23:28 UTC (permalink / raw)
  To: Marek Vasut, linux-clk
  Cc: Marek Vasut, Biju Das, Alexander Stein, Conor Dooley,
	Geert Uytterhoeven, Krzysztof Kozlowski, Michael Turquette,
	Rob Herring, devicetree, linux-renesas-soc

Quoting Marek Vasut (2023-11-13 14:18:52)
> Extract only vendor ID from VID register, the top 4 bits are
> revision ID which are not useful for the vendor ID check.
> 
> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 3/4] clk: rs9: Replace model check with bitshift from chip data
  2023-11-13 22:18 ` [PATCH v3 3/4] clk: rs9: Replace model check with bitshift from chip data Marek Vasut
@ 2023-12-17 23:28   ` Stephen Boyd
  0 siblings, 0 replies; 8+ messages in thread
From: Stephen Boyd @ 2023-12-17 23:28 UTC (permalink / raw)
  To: Marek Vasut, linux-clk
  Cc: Marek Vasut, Alexander Stein, Conor Dooley, Geert Uytterhoeven,
	Krzysztof Kozlowski, Michael Turquette, Rob Herring, devicetree,
	linux-renesas-soc

Quoting Marek Vasut (2023-11-13 14:18:53)
> Adjust rs9_calc_dif() to special-case the 9FGV0241 where DIFx bits
> start at 1, encode this shift into chip data and drop the model
> check entirely.
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 4/4] clk: rs9: Add support for 9FGV0841
  2023-11-13 22:18 ` [PATCH v3 4/4] clk: rs9: Add support for 9FGV0841 Marek Vasut
@ 2023-12-17 23:29   ` Stephen Boyd
  0 siblings, 0 replies; 8+ messages in thread
From: Stephen Boyd @ 2023-12-17 23:29 UTC (permalink / raw)
  To: Marek Vasut, linux-clk
  Cc: Marek Vasut, Biju Das, Alexander Stein, Conor Dooley,
	Geert Uytterhoeven, Krzysztof Kozlowski, Michael Turquette,
	Rob Herring, devicetree, linux-renesas-soc

Quoting Marek Vasut (2023-11-13 14:18:54)
> This model is similar to 9FGV0441, the DIFx bits start at bit 0 again,
> except this chip has 8 outputs.
> 
> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-12-17 23:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-13 22:18 [PATCH v3 1/4] dt-bindings: clk: rs9: Add 9FGV0841 Marek Vasut
2023-11-13 22:18 ` [PATCH v3 2/4] clk: rs9: Limit check to vendor ID in VID register Marek Vasut
2023-12-17 23:28   ` Stephen Boyd
2023-11-13 22:18 ` [PATCH v3 3/4] clk: rs9: Replace model check with bitshift from chip data Marek Vasut
2023-12-17 23:28   ` Stephen Boyd
2023-11-13 22:18 ` [PATCH v3 4/4] clk: rs9: Add support for 9FGV0841 Marek Vasut
2023-12-17 23:29   ` Stephen Boyd
2023-12-17 23:28 ` [PATCH v3 1/4] dt-bindings: clk: rs9: Add 9FGV0841 Stephen Boyd

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).