]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
net: dsa: microchip: Support optional 125MHz SYNCLKO output
authorRobert Hancock <hancock@sedsystems.ca>
Wed, 12 Jun 2019 20:49:06 +0000 (14:49 -0600)
committerDavid S. Miller <davem@davemloft.net>
Sat, 15 Jun 2019 02:11:53 +0000 (19:11 -0700)
The KSZ9477 series chips have a SYNCLKO pin which by default outputs a
25MHz clock, but some board setups require a 125MHz clock instead. Added
a microchip,synclko-125 device tree property to allow indicating a
125MHz clock output is required.

Signed-off-by: Robert Hancock <hancock@sedsystems.ca>
Signed-off-by: David S. Miller <davem@davemloft.net>
Documentation/devicetree/bindings/net/dsa/ksz.txt
drivers/net/dsa/microchip/ksz9477.c
drivers/net/dsa/microchip/ksz_common.c
drivers/net/dsa/microchip/ksz_priv.h

index e7db7268fd0fd6502d81e2d6014b041895292236..4ac21cef370ece9fb5b769b3c217d47d5a08d2d9 100644 (file)
@@ -16,6 +16,8 @@ Required properties:
 Optional properties:
 
 - reset-gpios          : Should be a gpio specifier for a reset line
+- microchip,synclko-125 : Set if the output SYNCLKO frequency should be set to
+                         125MHz instead of 25MHz.
 
 See Documentation/devicetree/bindings/net/dsa/dsa.txt for a list of additional
 required and optional properties.
index 7be6d848b69f8d58faad279a40791281dcd56afc..508380f80875bb454c3325ee0f9b27b98c8e7d13 100644 (file)
@@ -258,6 +258,10 @@ static int ksz9477_reset_switch(struct ksz_device *dev)
        data16 |= (BROADCAST_STORM_VALUE * BROADCAST_STORM_PROT_RATE) / 100;
        ksz_write16(dev, REG_SW_MAC_CTRL_2, data16);
 
+       if (dev->synclko_125)
+               ksz_write8(dev, REG_SW_GLOBAL_OUTPUT_CTRL__1,
+                          SW_ENABLE_REFCLKO | SW_REFCLKO_IS_125MHZ);
+
        return 0;
 }
 
index 39dace8e3512a4a49d5f5789e1b08477f92c030b..40c57d84816f8e75d6980a6267f6bec9a625f2db 100644 (file)
@@ -460,6 +460,8 @@ int ksz_switch_register(struct ksz_device *dev,
                ret = of_get_phy_mode(dev->dev->of_node);
                if (ret >= 0)
                        dev->interface = ret;
+               dev->synclko_125 = of_property_read_bool(dev->dev->of_node,
+                                                        "microchip,synclko-125");
        }
 
        ret = dsa_register_switch(dev->ds);
index 724301df91db4d8b0298da9f4d5d61db52bacdac..c615d2a81dd52752ce167b816d599a02a6206fca 100644 (file)
@@ -78,6 +78,7 @@ struct ksz_device {
        phy_interface_t interface;
        u32 regs_size;
        bool phy_errata_9477;
+       bool synclko_125;
 
        struct vlan_table *vlan_cache;