All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next v4 0/2] Allow disabling KSZ switch refclock
@ 2022-01-27 16:41 Robert Hancock
  2022-01-27 16:41 ` [PATCH net-next v4 1/2] net: dsa: microchip: Document property to disable reference clock Robert Hancock
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Robert Hancock @ 2022-01-27 16:41 UTC (permalink / raw)
  To: netdev
  Cc: woojung.huh, UNGLinuxDriver, andrew, vivien.didelot, f.fainelli,
	olteanv, davem, kuba, robh+dt, marex, devicetree, Robert Hancock

The reference clock output from the KSZ9477 and related Microchip
switch devices is not required on all board designs. Add a device
tree property to disable it for power and EMI reasons.

Changes since v3:
-rework some code for simplicity

Changes since v2:
-check for conflicting options in DT, added note in bindings doc

Changes since v1:
-added Acked-by on patch 1, rebase to net-next

Robert Hancock (2):
  net: dsa: microchip: Document property to disable reference clock
  net: dsa: microchip: Add property to disable reference clock

 .../devicetree/bindings/net/dsa/microchip,ksz.yaml       | 6 ++++++
 drivers/net/dsa/microchip/ksz9477.c                      | 9 ++++++---
 drivers/net/dsa/microchip/ksz_common.c                   | 6 ++++++
 drivers/net/dsa/microchip/ksz_common.h                   | 1 +
 4 files changed, 19 insertions(+), 3 deletions(-)

-- 
2.31.1


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

* [PATCH net-next v4 1/2] net: dsa: microchip: Document property to disable reference clock
  2022-01-27 16:41 [PATCH net-next v4 0/2] Allow disabling KSZ switch refclock Robert Hancock
@ 2022-01-27 16:41 ` Robert Hancock
  2022-01-27 16:56   ` Florian Fainelli
  2022-01-27 16:41 ` [PATCH net-next v4 2/2] net: dsa: microchip: Add " Robert Hancock
  2022-01-28 15:10 ` [PATCH net-next v4 0/2] Allow disabling KSZ switch refclock patchwork-bot+netdevbpf
  2 siblings, 1 reply; 6+ messages in thread
From: Robert Hancock @ 2022-01-27 16:41 UTC (permalink / raw)
  To: netdev
  Cc: woojung.huh, UNGLinuxDriver, andrew, vivien.didelot, f.fainelli,
	olteanv, davem, kuba, robh+dt, marex, devicetree, Robert Hancock,
	Rob Herring

Document the new microchip,synclko-disable property which can be
specified to disable the reference clock output from the device if not
required by the board design.

Signed-off-by: Robert Hancock <robert.hancock@calian.com>
Acked-by: Rob Herring <robh@kernel.org>
---
 .../devicetree/bindings/net/dsa/microchip,ksz.yaml          | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml b/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml
index 84985f53bffd..184152087b60 100644
--- a/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml
@@ -42,6 +42,12 @@ properties:
     description:
       Set if the output SYNCLKO frequency should be set to 125MHz instead of 25MHz.
 
+  microchip,synclko-disable:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description:
+      Set if the output SYNCLKO clock should be disabled. Do not mix with
+      microchip,synclko-125.
+
 required:
   - compatible
   - reg
-- 
2.31.1


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

* [PATCH net-next v4 2/2] net: dsa: microchip: Add property to disable reference clock
  2022-01-27 16:41 [PATCH net-next v4 0/2] Allow disabling KSZ switch refclock Robert Hancock
  2022-01-27 16:41 ` [PATCH net-next v4 1/2] net: dsa: microchip: Document property to disable reference clock Robert Hancock
@ 2022-01-27 16:41 ` Robert Hancock
  2022-01-27 16:57   ` Florian Fainelli
  2022-01-28 15:10 ` [PATCH net-next v4 0/2] Allow disabling KSZ switch refclock patchwork-bot+netdevbpf
  2 siblings, 1 reply; 6+ messages in thread
From: Robert Hancock @ 2022-01-27 16:41 UTC (permalink / raw)
  To: netdev
  Cc: woojung.huh, UNGLinuxDriver, andrew, vivien.didelot, f.fainelli,
	olteanv, davem, kuba, robh+dt, marex, devicetree, Robert Hancock

Add a new microchip,synclko-disable property which can be specified
to disable the reference clock output from the device if not required
by the board design.

Signed-off-by: Robert Hancock <robert.hancock@calian.com>
---
 drivers/net/dsa/microchip/ksz9477.c    | 9 ++++++---
 drivers/net/dsa/microchip/ksz_common.c | 6 ++++++
 drivers/net/dsa/microchip/ksz_common.h | 1 +
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
index 353b5f981740..a85d990896b0 100644
--- a/drivers/net/dsa/microchip/ksz9477.c
+++ b/drivers/net/dsa/microchip/ksz9477.c
@@ -222,9 +222,12 @@ static int ksz9477_reset_switch(struct ksz_device *dev)
 			   (BROADCAST_STORM_VALUE *
 			   BROADCAST_STORM_PROT_RATE) / 100);
 
-	if (dev->synclko_125)
-		ksz_write8(dev, REG_SW_GLOBAL_OUTPUT_CTRL__1,
-			   SW_ENABLE_REFCLKO | SW_REFCLKO_IS_125MHZ);
+	data8 = SW_ENABLE_REFCLKO;
+	if (dev->synclko_disable)
+		data8 = 0;
+	else if (dev->synclko_125)
+		data8 = SW_ENABLE_REFCLKO | SW_REFCLKO_IS_125MHZ;
+	ksz_write8(dev, REG_SW_GLOBAL_OUTPUT_CTRL__1, data8);
 
 	return 0;
 }
diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
index 55dbda04ea62..7e33ec73f803 100644
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -434,6 +434,12 @@ int ksz_switch_register(struct ksz_device *dev,
 			}
 		dev->synclko_125 = of_property_read_bool(dev->dev->of_node,
 							 "microchip,synclko-125");
+		dev->synclko_disable = of_property_read_bool(dev->dev->of_node,
+							     "microchip,synclko-disable");
+		if (dev->synclko_125 && dev->synclko_disable) {
+			dev_err(dev->dev, "inconsistent synclko settings\n");
+			return -EINVAL;
+		}
 	}
 
 	ret = dsa_register_switch(dev->ds);
diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h
index df8ae59c8525..3db63f62f0a1 100644
--- a/drivers/net/dsa/microchip/ksz_common.h
+++ b/drivers/net/dsa/microchip/ksz_common.h
@@ -75,6 +75,7 @@ struct ksz_device {
 	u32 regs_size;
 	bool phy_errata_9477;
 	bool synclko_125;
+	bool synclko_disable;
 
 	struct vlan_table *vlan_cache;
 
-- 
2.31.1


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

* Re: [PATCH net-next v4 1/2] net: dsa: microchip: Document property to disable reference clock
  2022-01-27 16:41 ` [PATCH net-next v4 1/2] net: dsa: microchip: Document property to disable reference clock Robert Hancock
@ 2022-01-27 16:56   ` Florian Fainelli
  0 siblings, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2022-01-27 16:56 UTC (permalink / raw)
  To: Robert Hancock, netdev
  Cc: woojung.huh, UNGLinuxDriver, andrew, vivien.didelot, olteanv,
	davem, kuba, robh+dt, marex, devicetree, Rob Herring



On 1/27/2022 8:41 AM, Robert Hancock wrote:
> Document the new microchip,synclko-disable property which can be
> specified to disable the reference clock output from the device if not
> required by the board design.
> 
> Signed-off-by: Robert Hancock <robert.hancock@calian.com>
> Acked-by: Rob Herring <robh@kernel.org>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

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

* Re: [PATCH net-next v4 2/2] net: dsa: microchip: Add property to disable reference clock
  2022-01-27 16:41 ` [PATCH net-next v4 2/2] net: dsa: microchip: Add " Robert Hancock
@ 2022-01-27 16:57   ` Florian Fainelli
  0 siblings, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2022-01-27 16:57 UTC (permalink / raw)
  To: Robert Hancock, netdev
  Cc: woojung.huh, UNGLinuxDriver, andrew, vivien.didelot, olteanv,
	davem, kuba, robh+dt, marex, devicetree



On 1/27/2022 8:41 AM, Robert Hancock wrote:
> Add a new microchip,synclko-disable property which can be specified
> to disable the reference clock output from the device if not required
> by the board design.
> 
> Signed-off-by: Robert Hancock <robert.hancock@calian.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

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

* Re: [PATCH net-next v4 0/2] Allow disabling KSZ switch refclock
  2022-01-27 16:41 [PATCH net-next v4 0/2] Allow disabling KSZ switch refclock Robert Hancock
  2022-01-27 16:41 ` [PATCH net-next v4 1/2] net: dsa: microchip: Document property to disable reference clock Robert Hancock
  2022-01-27 16:41 ` [PATCH net-next v4 2/2] net: dsa: microchip: Add " Robert Hancock
@ 2022-01-28 15:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-01-28 15:10 UTC (permalink / raw)
  To: Robert Hancock
  Cc: netdev, woojung.huh, UNGLinuxDriver, andrew, vivien.didelot,
	f.fainelli, olteanv, davem, kuba, robh+dt, marex, devicetree

Hello:

This series was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Thu, 27 Jan 2022 10:41:54 -0600 you wrote:
> The reference clock output from the KSZ9477 and related Microchip
> switch devices is not required on all board designs. Add a device
> tree property to disable it for power and EMI reasons.
> 
> Changes since v3:
> -rework some code for simplicity
> 
> [...]

Here is the summary with links:
  - [net-next,v4,1/2] net: dsa: microchip: Document property to disable reference clock
    https://git.kernel.org/netdev/net-next/c/eccfecfe587b
  - [net-next,v4,2/2] net: dsa: microchip: Add property to disable reference clock
    https://git.kernel.org/netdev/net-next/c/48bf8b8a04c9

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2022-01-28 15:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-27 16:41 [PATCH net-next v4 0/2] Allow disabling KSZ switch refclock Robert Hancock
2022-01-27 16:41 ` [PATCH net-next v4 1/2] net: dsa: microchip: Document property to disable reference clock Robert Hancock
2022-01-27 16:56   ` Florian Fainelli
2022-01-27 16:41 ` [PATCH net-next v4 2/2] net: dsa: microchip: Add " Robert Hancock
2022-01-27 16:57   ` Florian Fainelli
2022-01-28 15:10 ` [PATCH net-next v4 0/2] Allow disabling KSZ switch refclock patchwork-bot+netdevbpf

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.