]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: dsa: microchip: Add property to disable reference clock
authorRobert Hancock <robert.hancock@calian.com>
Thu, 27 Jan 2022 16:41:56 +0000 (10:41 -0600)
committerDavid S. Miller <davem@davemloft.net>
Fri, 28 Jan 2022 14:39:44 +0000 (14:39 +0000)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/microchip/ksz9477.c
drivers/net/dsa/microchip/ksz_common.c
drivers/net/dsa/microchip/ksz_common.h

index 353b5f98174075399159f86dd1327883dffbc4e0..a85d990896b09021cdcbffe0a8e8fde627399402 100644 (file)
@@ -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;
 }
index 55dbda04ea6289d5a8d1db95403830140044452f..7e33ec73f80363cd27847c83b732e44e017bf70e 100644 (file)
@@ -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);
index df8ae59c85258fdcb2ac402d4a65a2593be83fb3..3db63f62f0a175a2a7c4aae386d990a1ed987912 100644 (file)
@@ -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;