]> www.infradead.org Git - users/hch/misc.git/commitdiff
net: xpcs: add function to configure EEE clock multiplying factor
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Mon, 10 Feb 2025 10:53:44 +0000 (10:53 +0000)
committerJakub Kicinski <kuba@kernel.org>
Fri, 14 Feb 2025 21:42:51 +0000 (13:42 -0800)
Add a function to separate out the EEE clock multiplying factor. This
will be called by the stmmac driver to configure this value.

It would have been better had the driver used the CLK API to retrieve
this clock, get its rate and calculate the appropriate multiplier, but
that door has closed.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/E1thRQ8-003w70-VT@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/pcs/pcs-xpcs.c
drivers/net/pcs/pcs-xpcs.h
include/linux/pcs/pcs-xpcs.h

index 1faa37f0e7b949604ff8f796161f75448f0a993b..91ce4b13df327b7a514164fb0bc035a1f3f78c79 100644 (file)
@@ -1193,6 +1193,20 @@ static void xpcs_an_restart(struct phylink_pcs *pcs)
                    BMCR_ANRESTART);
 }
 
+/**
+ * xpcs_config_eee_mult_fact() - set the EEE clock multiplying factor
+ * @xpcs: pointer to a &struct dw_xpcs instance
+ * @mult_fact: the multiplying factor
+ *
+ * Configure the EEE clock multiplying factor. This value should be such that
+ * clk_eee_time_period * (mult_fact + 1) is within the range 80 to 120ns.
+ */
+void xpcs_config_eee_mult_fact(struct dw_xpcs *xpcs, u8 mult_fact)
+{
+       xpcs->eee_mult_fact = mult_fact;
+}
+EXPORT_SYMBOL_GPL(xpcs_config_eee_mult_fact);
+
 static int xpcs_read_ids(struct dw_xpcs *xpcs)
 {
        int ret;
index adc5a0b3c88317a58856ef81fa2ef5d50a780ef2..39d3f517b557baa45a7f2d18f89616914e0eddf5 100644 (file)
@@ -122,6 +122,7 @@ struct dw_xpcs {
        struct phylink_pcs pcs;
        phy_interface_t interface;
        bool need_reset;
+       u8 eee_mult_fact;
 };
 
 int xpcs_read(struct dw_xpcs *xpcs, int dev, u32 reg);
index 733f4ddd2ef15f0209278f65c2e8d8ed27c73a08..749d40a9a0867d9b3fd1436149a1e7cf69f46d85 100644 (file)
@@ -52,6 +52,7 @@ struct phylink_pcs *xpcs_to_phylink_pcs(struct dw_xpcs *xpcs);
 int xpcs_get_an_mode(struct dw_xpcs *xpcs, phy_interface_t interface);
 int xpcs_config_eee(struct dw_xpcs *xpcs, int mult_fact_100ns,
                    int enable);
+void xpcs_config_eee_mult_fact(struct dw_xpcs *xpcs, u8 mult_fact);
 struct dw_xpcs *xpcs_create_mdiodev(struct mii_bus *bus, int addr);
 struct dw_xpcs *xpcs_create_fwnode(struct fwnode_handle *fwnode);
 void xpcs_destroy(struct dw_xpcs *xpcs);