On Wed, 29 Mar 2023 10:57:00 +0800 Guo Samin wrote: > static void starfive_dwmac_fix_mac_speed(void *priv, unsigned int speed) > { > struct starfive_dwmac *dwmac = priv; > unsigned long rate; > int err; > > rate = clk_get_rate(dwmac->tx_clk); > > switch (speed) { > case SPEED_1000: > rate = 125000000; > break; > case SPEED_100: > rate = 25000000; > break; > case SPEED_10: > rate = 2500000; > break; > default: > dev_err(dwmac->dev, "invalid speed %u\n", speed); > break; > } > > err = clk_set_rate(dwmac->clk_tx, rate); > if (err) > dev_err(dwmac->dev, "failed to set tx rate %lu\n", rate); > } > > What do you think? Yup, that's even better.