netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] Allow disabling KSZ switch refclock
@ 2022-01-12 18:22 Robert Hancock
  2022-01-12 18:22 ` [PATCH net-next 1/2] net: dsa: microchip: Document property to disable reference clock Robert Hancock
  2022-01-12 18:22 ` [PATCH net-next 2/2] net: dsa: microchip: Add " Robert Hancock
  0 siblings, 2 replies; 4+ messages in thread
From: Robert Hancock @ 2022-01-12 18:22 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.

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         | 5 +++++
 drivers/net/dsa/microchip/ksz9477.c                        | 7 ++++++-
 drivers/net/dsa/microchip/ksz_common.c                     | 2 ++
 drivers/net/dsa/microchip/ksz_common.h                     | 1 +
 4 files changed, 14 insertions(+), 1 deletion(-)

-- 
2.31.1


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

* [PATCH net-next 1/2] net: dsa: microchip: Document property to disable reference clock
  2022-01-12 18:22 [PATCH net-next 0/2] Allow disabling KSZ switch refclock Robert Hancock
@ 2022-01-12 18:22 ` Robert Hancock
  2022-01-22  1:08   ` Rob Herring
  2022-01-12 18:22 ` [PATCH net-next 2/2] net: dsa: microchip: Add " Robert Hancock
  1 sibling, 1 reply; 4+ messages in thread
From: Robert Hancock @ 2022-01-12 18:22 UTC (permalink / raw)
  To: netdev
  Cc: woojung.huh, UNGLinuxDriver, andrew, vivien.didelot, f.fainelli,
	olteanv, davem, kuba, robh+dt, marex, devicetree, Robert Hancock

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>
---
 Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml b/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml
index 84985f53bffd..7cc22ab1787c 100644
--- a/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml
@@ -42,6 +42,11 @@ 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.
+
 required:
   - compatible
   - reg
-- 
2.31.1


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

* [PATCH net-next 2/2] net: dsa: microchip: Add property to disable reference clock
  2022-01-12 18:22 [PATCH net-next 0/2] Allow disabling KSZ switch refclock Robert Hancock
  2022-01-12 18:22 ` [PATCH net-next 1/2] net: dsa: microchip: Document property to disable reference clock Robert Hancock
@ 2022-01-12 18:22 ` Robert Hancock
  1 sibling, 0 replies; 4+ messages in thread
From: Robert Hancock @ 2022-01-12 18:22 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    | 7 ++++++-
 drivers/net/dsa/microchip/ksz_common.c | 2 ++
 drivers/net/dsa/microchip/ksz_common.h | 1 +
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
index 353b5f981740..33d52050cd68 100644
--- a/drivers/net/dsa/microchip/ksz9477.c
+++ b/drivers/net/dsa/microchip/ksz9477.c
@@ -222,9 +222,14 @@ static int ksz9477_reset_switch(struct ksz_device *dev)
 			   (BROADCAST_STORM_VALUE *
 			   BROADCAST_STORM_PROT_RATE) / 100);
 
-	if (dev->synclko_125)
+	if (dev->synclko_disable)
+		ksz_write8(dev, REG_SW_GLOBAL_OUTPUT_CTRL__1, 0);
+	else if (dev->synclko_125)
 		ksz_write8(dev, REG_SW_GLOBAL_OUTPUT_CTRL__1,
 			   SW_ENABLE_REFCLKO | SW_REFCLKO_IS_125MHZ);
+	else
+		ksz_write8(dev, REG_SW_GLOBAL_OUTPUT_CTRL__1,
+			   SW_ENABLE_REFCLKO);
 
 	return 0;
 }
diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
index 55dbda04ea62..0a524f1f227a 100644
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -434,6 +434,8 @@ 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");
 	}
 
 	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] 4+ messages in thread

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

On Wed, 12 Jan 2022 12:22:50 -0600, 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>
> ---
>  Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml | 5 +++++
>  1 file changed, 5 insertions(+)
> 

Acked-by: Rob Herring <robh@kernel.org>

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

end of thread, other threads:[~2022-01-22  1:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-12 18:22 [PATCH net-next 0/2] Allow disabling KSZ switch refclock Robert Hancock
2022-01-12 18:22 ` [PATCH net-next 1/2] net: dsa: microchip: Document property to disable reference clock Robert Hancock
2022-01-22  1:08   ` Rob Herring
2022-01-12 18:22 ` [PATCH net-next 2/2] net: dsa: microchip: Add " Robert Hancock

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