Skip to content

Commit 8c84148

Browse files
Russell King (Oracle)kuba-moo
authored andcommitted
net: xpcs: add function to configure EEE clock multiplying factor
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) <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent e9f03a6 commit 8c84148

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

drivers/net/pcs/pcs-xpcs.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,6 +1193,20 @@ static void xpcs_an_restart(struct phylink_pcs *pcs)
11931193
BMCR_ANRESTART);
11941194
}
11951195

1196+
/**
1197+
* xpcs_config_eee_mult_fact() - set the EEE clock multiplying factor
1198+
* @xpcs: pointer to a &struct dw_xpcs instance
1199+
* @mult_fact: the multiplying factor
1200+
*
1201+
* Configure the EEE clock multiplying factor. This value should be such that
1202+
* clk_eee_time_period * (mult_fact + 1) is within the range 80 to 120ns.
1203+
*/
1204+
void xpcs_config_eee_mult_fact(struct dw_xpcs *xpcs, u8 mult_fact)
1205+
{
1206+
xpcs->eee_mult_fact = mult_fact;
1207+
}
1208+
EXPORT_SYMBOL_GPL(xpcs_config_eee_mult_fact);
1209+
11961210
static int xpcs_read_ids(struct dw_xpcs *xpcs)
11971211
{
11981212
int ret;

drivers/net/pcs/pcs-xpcs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ struct dw_xpcs {
122122
struct phylink_pcs pcs;
123123
phy_interface_t interface;
124124
bool need_reset;
125+
u8 eee_mult_fact;
125126
};
126127

127128
int xpcs_read(struct dw_xpcs *xpcs, int dev, u32 reg);

include/linux/pcs/pcs-xpcs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ struct phylink_pcs *xpcs_to_phylink_pcs(struct dw_xpcs *xpcs);
5252
int xpcs_get_an_mode(struct dw_xpcs *xpcs, phy_interface_t interface);
5353
int xpcs_config_eee(struct dw_xpcs *xpcs, int mult_fact_100ns,
5454
int enable);
55+
void xpcs_config_eee_mult_fact(struct dw_xpcs *xpcs, u8 mult_fact);
5556
struct dw_xpcs *xpcs_create_mdiodev(struct mii_bus *bus, int addr);
5657
struct dw_xpcs *xpcs_create_fwnode(struct fwnode_handle *fwnode);
5758
void xpcs_destroy(struct dw_xpcs *xpcs);

0 commit comments

Comments
 (0)