mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-02 15:43:35 -04:00
net: stmmac: intel: use generic stmmac_set_clk_tx_rate()
Use the generic stmmac_set_clk_tx_rate() to configure the MAC transmit clock. Note that given the current unpatched driver structure, plat_dat->fix_mac_speed will always be populated with kmb_eth_fix_mac_speed(), even when no clock is present. We preserve this behaviour in this patch by always initialising plat_dat->clk_tx_i and plat_dat->set_clk_tx_rate. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Link: https://patch.msgid.link/E1tna0f-0052sw-8r@rmk-PC.armlinux.org.uk Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
36fa8c9607
commit
61356fb1b0
@@ -22,31 +22,12 @@ struct intel_dwmac {
|
||||
};
|
||||
|
||||
struct intel_dwmac_data {
|
||||
void (*fix_mac_speed)(void *priv, int speed, unsigned int mode);
|
||||
unsigned long ptp_ref_clk_rate;
|
||||
unsigned long tx_clk_rate;
|
||||
bool tx_clk_en;
|
||||
};
|
||||
|
||||
static void kmb_eth_fix_mac_speed(void *priv, int speed, unsigned int mode)
|
||||
{
|
||||
struct intel_dwmac *dwmac = priv;
|
||||
long rate;
|
||||
int ret;
|
||||
|
||||
rate = rgmii_clock(speed);
|
||||
if (rate < 0) {
|
||||
dev_err(dwmac->dev, "Invalid speed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
ret = clk_set_rate(dwmac->tx_clk, rate);
|
||||
if (ret)
|
||||
dev_err(dwmac->dev, "Failed to configure tx clock rate\n");
|
||||
}
|
||||
|
||||
static const struct intel_dwmac_data kmb_data = {
|
||||
.fix_mac_speed = kmb_eth_fix_mac_speed,
|
||||
.ptp_ref_clk_rate = 200000000,
|
||||
.tx_clk_rate = 125000000,
|
||||
.tx_clk_en = true,
|
||||
@@ -89,8 +70,6 @@ static int intel_eth_plat_probe(struct platform_device *pdev)
|
||||
* platform_match().
|
||||
*/
|
||||
dwmac->data = device_get_match_data(&pdev->dev);
|
||||
if (dwmac->data->fix_mac_speed)
|
||||
plat_dat->fix_mac_speed = dwmac->data->fix_mac_speed;
|
||||
|
||||
/* Enable TX clock */
|
||||
if (dwmac->data->tx_clk_en) {
|
||||
@@ -132,6 +111,9 @@ static int intel_eth_plat_probe(struct platform_device *pdev)
|
||||
}
|
||||
}
|
||||
|
||||
plat_dat->clk_tx_i = dwmac->tx_clk;
|
||||
plat_dat->set_clk_tx_rate = stmmac_set_clk_tx_rate;
|
||||
|
||||
plat_dat->bsp_priv = dwmac;
|
||||
plat_dat->eee_usecs_rate = plat_dat->clk_ptp_rate;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user