Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'net-stmmac-sunxi-cleanups'

Russell King says:

====================
net: stmmac: sunxi cleanups

This series cleans up the sunxi (sun7i) code in two ways:

1. it converts to use the new set_clk_tx_rate() method, even though
we don't use clk_tx_i. In doing so, I reformat the function to
read better, but with no changes to the code.

2. convert from stmmac_dvr_probe() to stmmac_pltfr_probe(), and then
to its devm variant, which allows code simplification.
====================

Link: https://patch.msgid.link/Z_5WT_jOBgubjWQg@shell.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+20 -34
+20 -34
drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c
··· 72 72 regulator_disable(gmac->regulator); 73 73 } 74 74 75 - static void sun7i_fix_speed(void *priv, int speed, unsigned int mode) 75 + static int sun7i_set_clk_tx_rate(void *bsp_priv, struct clk *clk_tx_i, 76 + phy_interface_t interface, int speed) 76 77 { 77 - struct sunxi_priv_data *gmac = priv; 78 + struct sunxi_priv_data *gmac = bsp_priv; 78 79 79 - /* only GMII mode requires us to reconfigure the clock lines */ 80 - if (gmac->interface != PHY_INTERFACE_MODE_GMII) 81 - return; 80 + if (interface == PHY_INTERFACE_MODE_GMII) { 81 + if (gmac->clk_enabled) { 82 + clk_disable(gmac->tx_clk); 83 + gmac->clk_enabled = 0; 84 + } 85 + clk_unprepare(gmac->tx_clk); 82 86 83 - if (gmac->clk_enabled) { 84 - clk_disable(gmac->tx_clk); 85 - gmac->clk_enabled = 0; 87 + if (speed == 1000) { 88 + clk_set_rate(gmac->tx_clk, SUN7I_GMAC_GMII_RGMII_RATE); 89 + clk_prepare_enable(gmac->tx_clk); 90 + gmac->clk_enabled = 1; 91 + } else { 92 + clk_set_rate(gmac->tx_clk, SUN7I_GMAC_MII_RATE); 93 + clk_prepare(gmac->tx_clk); 94 + } 86 95 } 87 - clk_unprepare(gmac->tx_clk); 88 - 89 - if (speed == 1000) { 90 - clk_set_rate(gmac->tx_clk, SUN7I_GMAC_GMII_RGMII_RATE); 91 - clk_prepare_enable(gmac->tx_clk); 92 - gmac->clk_enabled = 1; 93 - } else { 94 - clk_set_rate(gmac->tx_clk, SUN7I_GMAC_MII_RATE); 95 - clk_prepare(gmac->tx_clk); 96 - } 96 + return 0; 97 97 } 98 98 99 99 static int sun7i_gmac_probe(struct platform_device *pdev) ··· 140 140 plat_dat->bsp_priv = gmac; 141 141 plat_dat->init = sun7i_gmac_init; 142 142 plat_dat->exit = sun7i_gmac_exit; 143 - plat_dat->fix_mac_speed = sun7i_fix_speed; 143 + plat_dat->set_clk_tx_rate = sun7i_set_clk_tx_rate; 144 144 plat_dat->tx_fifo_size = 4096; 145 145 plat_dat->rx_fifo_size = 16384; 146 146 147 - ret = sun7i_gmac_init(pdev, plat_dat->bsp_priv); 148 - if (ret) 149 - return ret; 150 - 151 - ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); 152 - if (ret) 153 - goto err_gmac_exit; 154 - 155 - return 0; 156 - 157 - err_gmac_exit: 158 - sun7i_gmac_exit(pdev, plat_dat->bsp_priv); 159 - 160 - return ret; 147 + return devm_stmmac_pltfr_probe(pdev, plat_dat, &stmmac_res); 161 148 } 162 149 163 150 static const struct of_device_id sun7i_dwmac_match[] = { ··· 155 168 156 169 static struct platform_driver sun7i_dwmac_driver = { 157 170 .probe = sun7i_gmac_probe, 158 - .remove = stmmac_pltfr_remove, 159 171 .driver = { 160 172 .name = "sun7i-dwmac", 161 173 .pm = &stmmac_pltfr_pm_ops,