Allow disabling KSZ switch refclock
Subsystems (5)
v2 cover Allow disabling KSZ switch refclock
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 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 | 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(-)
Signature · 1 line
2.31.1
PATCH v2 1/2 net: dsa: microchip: Document property to disable reference clock
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.
--- Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml | 5 +++++ 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml +5 -0
@@ -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
Signature · 1 line
2.31.1
PATCH v2 2/2 net: dsa: microchip: Add property to disable reference clock
In reply to Robert HancockAdd 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.
--- 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(-)
drivers/net/dsa/microchip/ksz9477.c +6 -1
@@ -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 ; }
drivers/net/dsa/microchip/ksz_common.c +2 -0
@@ -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);
drivers/net/dsa/microchip/ksz_common.h +1 -0
@@ -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;
Signature · 1 line
2.31.1
Andrew Lunn
maintainerRe: [PATCH net-next v2 2/2] net: dsa: microchip: Add property to disable reference clock
drivers/net/dsa/microchip/ksz_common.c int ksz_switch_register(struct ksz_device *dev, · line 438
Quoted 4 lines
drivers/net/dsa/microchip/ksz_common.c +2
-0dev->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" );
It seems like microchip,synclko-125 and microchip,synclko-disable are mutually exclusive? Please add an -EINVAL if both a present.
This should also be mentioned in the binding document.
Thanks
Andrew