mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-04 04:02:26 +00:00
net: dwmac-starfive: Use helper rgmii_clock
Utilize a new helper function rgmii_clock(). Reviewed-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Reviewed-by: Emil Renner Berthing <emil.renner.berthing@canonical.com> Signed-off-by: Jan Petrous (OSS) <jan.petrous@oss.nxp.com> Link: https://patch.msgid.link/20241205-upstream_s32cc_gmac-v8-9-ec1d180df815@oss.nxp.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
30b4a9b5c3
commit
b561d717a7
@ -34,24 +34,13 @@ struct starfive_dwmac {
|
||||
static void starfive_dwmac_fix_mac_speed(void *priv, unsigned int speed, unsigned int mode)
|
||||
{
|
||||
struct starfive_dwmac *dwmac = priv;
|
||||
unsigned long rate;
|
||||
long rate;
|
||||
int err;
|
||||
|
||||
rate = clk_get_rate(dwmac->clk_tx);
|
||||
|
||||
switch (speed) {
|
||||
case SPEED_1000:
|
||||
rate = 125000000;
|
||||
break;
|
||||
case SPEED_100:
|
||||
rate = 25000000;
|
||||
break;
|
||||
case SPEED_10:
|
||||
rate = 2500000;
|
||||
break;
|
||||
default:
|
||||
rate = rgmii_clock(speed);
|
||||
if (rate < 0) {
|
||||
dev_err(dwmac->dev, "invalid speed %u\n", speed);
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
err = clk_set_rate(dwmac->clk_tx, rate);
|
||||
|
Loading…
Reference in New Issue
Block a user