stmmac clean up for 4.3 part2
Subsystems (8)
cover stmmac clean up for 4.3 part2
This patch set creates proper probe functions in the remaining dwmac-* drivers, lets the drivers manage their own of match data structure, and cleans up some of the drivers a bit. Note that should be no functional change in any of the drivers.
First patch from Fengguang fixes a Coccinelle that was found after the previous patch set when into next.
Probe functions are best placed just above the platform_driver struct since it usually needs to call other functions in the driver but this requires some code movement in the drivers. To keep the conversion itself easier to review the code movement is done in separate patches. This creates some extra churn but I think it's worth it in this case.
As only a couple of drivers actually needs to use of match data this pushed down from stmmac_platform and into the drivers. This also makes it possible for drivers to have their own match data structure. dwmac-rk benefits most from this.
After each driver has it's own probe function and manages it's own match data the setup/free hooks and common match data struct are removed.
Sorry for the slightly largish patch set this time around.
Since I can only test the core changes on my platform and not the specific dwmac-drivers I greatly appreciate if people could test this on their respective platforms. I did spend quite a bit of time visually checking all these patches, but nothing beats real hardware testing. Thanks!
Patch set based on net-next can also be picked up from here:
https://github.com/manabian/linux-lpc.git stmmac_4.3_part2
For those who want to have a look at all the patches for v4.3 a branch based on Linus master can be found here:
https://github.com/manabian/linux-lpc.git stmmac_4.2
Previous parts can be found here:
http://www.spinics.net/lists/netdev/msg328997.html
http://www.spinics.net/lists/netdev/msg329932.html
http://www.spinics.net/lists/netdev/msg336097.html
Fengguang Wu (1):
stmmac: fix ptr_ret.cocci warning
Joachim Eastwood (16):
stmmac: dwmac-ipq806x: move ipq806x_gmac_fix_mac_speed function
stmmac: dwmac-ipq806x: turn setup callback into a probe function
stmmac: dwmac-socfpga: move socfpga_dwmac_probe function
stmmac: dwmac-socfpga: turn setup callback into a probe function
stmmac: dwmac-sunxi: move sun7i_gmac_setup function
stmmac: dwmac-sunxi: turn setup callback into a probe function
stmmac: dwmac-sti: turn setup callback into a probe function
stmmac: dwmac-rk: create a new probe function
stmmac: move stmmac_pltfr_probe into dwmac-generic
stmmac: let dwmac-* drivers handle their own match data
stmmac: dwmac-sti: use custom of match structure
stmmac: dwmac-rk: make rk_gmac_ops structs static const
stmmac: dwmac-rk: use rk_gmac_ops as of match data
stmmac: remove unused stmmac_of_data struct
stmmac: remove setup/free glue callbacks
stmmac: dwmac-sti: refactor the init glue callbacks
Documentation/networking/stmmac.txt | 10 +-- .../net/ethernet/stmicro/stmmac/dwmac-generic.c | 42 +++++++++- .../net/ethernet/stmicro/stmmac/dwmac-ipq806x.c | 50 +++++++----- drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 73 ++++++++++------- .../net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 78 ++++++++++-------- drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c | 83 ++++++++++--------- drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c | 95 ++++++++++++---------- .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 80 +----------------- .../net/ethernet/stmicro/stmmac/stmmac_platform.h | 1 - include/linux/stmmac.h | 20 ----- 10 files changed, 260 insertions(+), 272 deletions(-)
Signature · 1 line
1.8.0
A message that is not in the archive (sent off-list or not yet received): 1438121344-5304-1-git-send-email-manabian-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
PATCH 9/17 stmmac: dwmac-rk: create a new probe function
Create a new probe functions that call the necessary setup functions. This is done in preparation for a code refactor in this driver and dropping the common probe function in stmmac_platform.c.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 40 ++++++++++++++++++++------ 1 file changed, 31 insertions(+), 9 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +31 -9
@@ -576,20 +576,42 @@ static void rk_fix_speed(void *priv, unsigned int speed)dev_err (dev,"unsupported interface %d" , bsp_priv->phy_iface); } +static int rk_gmac_probe (struct platform_device *pdev) +{ +struct plat_stmmacenet_data *plat_dat; +struct stmmac_resources stmmac_res; +int ret; + + ret =stmmac_get_platform_resources (pdev, &stmmac_res); +if (ret) +return ret; + + plat_dat =stmmac_probe_config_dt (pdev, &stmmac_res.mac); +if (IS_ERR (plat_dat)) +return PTR_ERR (plat_dat); + + plat_dat->has_gmac = true; + plat_dat->init = rk_gmac_init; + plat_dat->exit = rk_gmac_exit; + plat_dat->fix_mac_speed = rk_fix_speed; + + plat_dat->bsp_priv = plat_dat->setup (pdev); +if (IS_ERR (plat_dat->bsp_priv)) +return PTR_ERR (plat_dat->bsp_priv); + + ret =rk_gmac_init (pdev, plat_dat->bsp_priv); +if (ret) +return ret; + +return stmmac_dvr_probe (&pdev->dev, plat_dat, &stmmac_res); +} +static const struct stmmac_of_data rk3288_gmac_data = { - .has_gmac =1 , - .fix_mac_speed = rk_fix_speed, .setup = rk3288_gmac_setup, - .init = rk_gmac_init, - .exit = rk_gmac_exit, };static const struct stmmac_of_data rk3368_gmac_data = { - .has_gmac =1 , - .fix_mac_speed = rk_fix_speed, .setup = rk3368_gmac_setup, - .init = rk_gmac_init, - .exit = rk_gmac_exit, };static const struct of_device_id rk_gmac_dwmac_match[] = {
@@ -600,7 +622,7 @@ static const struct of_device_id rk_gmac_dwmac_match[] = {MODULE_DEVICE_TABLE (of, rk_gmac_dwmac_match);static struct platform_driver rk_gmac_dwmac_driver = { - .probe = stmmac_pltfr_probe, + .probe = rk_gmac_probe, .remove = stmmac_pltfr_remove, .driver = { .name ="rk_gmac-dwmac" ,
Signature · 1 line
1.8.0
PATCH 13/17 stmmac: dwmac-rk: make rk_gmac_ops structs static const
In reply to a message not in the archiveMark the rk_gmac_ops structures as static const as they should be.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +4 -4
@@ -46,7 +46,7 @@ struct rk_priv_data {struct platform_device *pdev;int phy_iface;struct regulator *regulator; -struct rk_gmac_ops *ops; +const struct rk_gmac_ops *ops;bool clk_enabled;bool clock_input;
@@ -177,7 +177,7 @@ static void rk3288_set_rmii_speed(struct rk_priv_data *bsp_priv, int speed) } } -struct rk_gmac_ops rk3288_ops = { +static const struct rk_gmac_ops rk3288_ops = { .set_to_rgmii = rk3288_set_to_rgmii, .set_to_rmii = rk3288_set_to_rmii, .set_rgmii_speed = rk3288_set_rgmii_speed,
@@ -289,7 +289,7 @@ static void rk3368_set_rmii_speed(struct rk_priv_data *bsp_priv, int speed) } } -struct rk_gmac_ops rk3368_ops = { +static const struct rk_gmac_ops rk3368_ops = { .set_to_rgmii = rk3368_set_to_rgmii, .set_to_rmii = rk3368_set_to_rmii, .set_rgmii_speed = rk3368_set_rgmii_speed,
@@ -448,7 +448,7 @@ static int phy_power_on(struct rk_priv_data *bsp_priv, bool enable) }static struct rk_priv_data *rk_gmac_setup (struct platform_device *pdev, -struct rk_gmac_ops *ops) +const struct rk_gmac_ops *ops) {struct rk_priv_data *bsp_priv;struct device *dev = &pdev->dev;
Signature · 1 line
1.8.0
PATCH 1/17 stmmac: fix ptr_ret.cocci warning
In reply to Joachim EastwoodFrom: Fengguang Wu <[email protected]>
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c:304:1-3: WARNING: PTR_ERR_OR_ZERO can be used
Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
Generated by: scripts/coccinelle/api/ptr_ret.cocci
--- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +1 -3
@@ -298,10 +298,8 @@ int stmmac_get_platform_resources(struct platform_device *pdev, res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); stmmac_res->addr =devm_ioremap_resource (&pdev->dev, res); -if (IS_ERR (stmmac_res->addr)) -return PTR_ERR (stmmac_res->addr); -return 0 ; +return PTR_ERR_OR_ZERO (stmmac_res->addr); }EXPORT_SYMBOL_GPL (stmmac_get_platform_resources);
Signature · 1 line
1.8.0
PATCH 2/17 stmmac: dwmac-ipq806x: move ipq806x_gmac_fix_mac_speed function
In reply to Joachim EastwoodMove ipq806x_gmac_fix_mac_speed in preparation for turning the setup glue callback in a proper probe function.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c +7 -7
@@ -248,6 +248,13 @@ static void *ipq806x_gmac_of_parse(struct ipq806x_gmac *gmac)return NULL ; } +static void ipq806x_gmac_fix_mac_speed (void *priv,unsigned int speed) +{ +struct ipq806x_gmac *gmac = priv; + +ipq806x_gmac_set_speed (gmac, speed); +} +static void *ipq806x_gmac_setup (struct platform_device *pdev) {struct device *dev = &pdev->dev;
@@ -330,13 +337,6 @@ static void *ipq806x_gmac_setup(struct platform_device *pdev)return gmac; } -static void ipq806x_gmac_fix_mac_speed (void *priv,unsigned int speed) -{ -struct ipq806x_gmac *gmac = priv; - -ipq806x_gmac_set_speed (gmac, speed); -} -static const struct stmmac_of_data ipq806x_gmac_data = { .has_gmac =1 , .setup = ipq806x_gmac_setup,
Signature · 1 line
1.8.0
PATCH 3/17 stmmac: dwmac-ipq806x: turn setup callback into a probe function
In reply to Joachim EastwoodBy using a few functions from stmmac_platform a proper probe function can be created from the setup glue callback. This makes it look more like a standard driver and the OF match data can also be dropped.
--- .../net/ethernet/stmicro/stmmac/dwmac-ipq806x.c | 38 +++++++++++++--------- 1 file changed, 23 insertions(+), 15 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c +23 -15
@@ -255,23 +255,33 @@ static void ipq806x_gmac_fix_mac_speed(void *priv, unsigned int speed)ipq806x_gmac_set_speed (gmac, speed); } -static void *ipq806x_gmac_setup (struct platform_device *pdev) +static int ipq806x_gmac_probe (struct platform_device *pdev) { +struct plat_stmmacenet_data *plat_dat; +struct stmmac_resources stmmac_res;struct device *dev = &pdev->dev;struct ipq806x_gmac *gmac;int val;void *err; + val =stmmac_get_platform_resources (pdev, &stmmac_res); +if (val) +return val; + + plat_dat =stmmac_probe_config_dt (pdev, &stmmac_res.mac); +if (IS_ERR (plat_dat)) +return PTR_ERR (plat_dat); + gmac =devm_kzalloc (dev,sizeof (*gmac),GFP_KERNEL );if (!gmac) -return ERR_PTR (-ENOMEM ); +return -ENOMEM ; gmac->pdev = pdev; err =ipq806x_gmac_of_parse (gmac); -if (err) { +if (IS_ERR (err)) {dev_err (dev,"device tree parsing error\n" ); -return err; +return PTR_ERR (err); } regmap_write(gmac->qsgmii_csr, QSGMII_PCS_CAL_LCKDT_CTL,
@@ -292,7 +302,7 @@ static void *ipq806x_gmac_setup(struct platform_device *pdev)default :dev_err (&pdev->dev,"Unsupported PHY mode: \"%s\"\n" ,phy_modes (gmac->phy_mode)); -return NULL ; +return -EINVAL ; }regmap_write (gmac->nss_common,NSS_COMMON_GMAC_CTL (gmac->id), val);
@@ -311,7 +321,7 @@ static void *ipq806x_gmac_setup(struct platform_device *pdev)default :dev_err (&pdev->dev,"Unsupported PHY mode: \"%s\"\n" ,phy_modes (gmac->phy_mode)); -return NULL ; +return -EINVAL ; }regmap_write (gmac->nss_common,NSS_COMMON_CLK_SRC_CTRL , val);
@@ -334,23 +344,21 @@ static void *ipq806x_gmac_setup(struct platform_device *pdev) 0xC << QSGMII_PHY_TX_DRV_AMP_OFFSET); } -return gmac; -} + plat_dat->has_gmac = true; + plat_dat->bsp_priv = gmac; + plat_dat->fix_mac_speed = ipq806x_gmac_fix_mac_speed; -static const struct stmmac_of_data ipq806x_gmac_data = { - .has_gmac =1 , - .setup = ipq806x_gmac_setup, - .fix_mac_speed = ipq806x_gmac_fix_mac_speed, -}; +return stmmac_dvr_probe (&pdev->dev, plat_dat, &stmmac_res); +}static const struct of_device_id ipq806x_gmac_dwmac_match[] = { - { .compatible ="qcom,ipq806x-gmac" , .data = &ipq806x_gmac_data }, + { .compatible ="qcom,ipq806x-gmac" }, { } };MODULE_DEVICE_TABLE (of, ipq806x_gmac_dwmac_match);static struct platform_driver ipq806x_gmac_dwmac_driver = { - .probe = stmmac_pltfr_probe, + .probe = ipq806x_gmac_probe, .remove = stmmac_pltfr_remove, .driver = { .name ="ipq806x-gmac-dwmac" ,
Signature · 1 line
1.8.0
PATCH 4/17 stmmac: dwmac-socfpga: move socfpga_dwmac_probe function
In reply to Joachim EastwoodMove socfpga_dwmac_probe in preparation for turning it into a proper probe function.
--- .../net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 50 +++++++++++----------- 1 file changed, 25 insertions(+), 25 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +25 -25
@@ -175,31 +175,6 @@ static int socfpga_dwmac_setup(struct socfpga_dwmac *dwmac)return 0 ; } -static void *socfpga_dwmac_probe (struct platform_device *pdev) -{ -struct device *dev = &pdev->dev; -int ret; -struct socfpga_dwmac *dwmac; - - dwmac =devm_kzalloc (dev,sizeof (*dwmac),GFP_KERNEL ); -if (!dwmac) -return ERR_PTR (-ENOMEM ); - - ret =socfpga_dwmac_parse_data (dwmac, dev); -if (ret) { -dev_err (dev,"Unable to parse OF data\n" ); -return ERR_PTR (ret); - } - - ret =socfpga_dwmac_setup (dwmac); -if (ret) { -dev_err (dev,"couldn't setup SoC glue (%d)\n" , ret); -return ERR_PTR (ret); - } - -return dwmac; -} -static void socfpga_dwmac_exit (struct platform_device *pdev,void *priv) {struct socfpga_dwmac *dwmac = priv;
@@ -257,6 +232,31 @@ static int socfpga_dwmac_init(struct platform_device *pdev, void *priv)return ret; } +static void *socfpga_dwmac_probe (struct platform_device *pdev) +{ +struct device *dev = &pdev->dev; +int ret; +struct socfpga_dwmac *dwmac; + + dwmac =devm_kzalloc (dev,sizeof (*dwmac),GFP_KERNEL ); +if (!dwmac) +return ERR_PTR (-ENOMEM ); + + ret =socfpga_dwmac_parse_data (dwmac, dev); +if (ret) { +dev_err (dev,"Unable to parse OF data\n" ); +return ERR_PTR (ret); + } + + ret =socfpga_dwmac_setup (dwmac); +if (ret) { +dev_err (dev,"couldn't setup SoC glue (%d)\n" , ret); +return ERR_PTR (ret); + } + +return dwmac; +} +static const struct stmmac_of_data socfpga_gmac_data = { .setup = socfpga_dwmac_probe, .init = socfpga_dwmac_init,
Signature · 1 line
1.8.0
PATCH 5/17 stmmac: dwmac-socfpga: turn setup callback into a probe function
In reply to Joachim EastwoodBy using a few functions from stmmac_platform a proper probe function can be created from the setup glue callback. This makes it look more like a standard driver and the OF match data can also be dropped.
--- .../net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 40 ++++++++++++++-------- 1 file changed, 26 insertions(+), 14 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +26 -14
@@ -232,46 +232,58 @@ static int socfpga_dwmac_init(struct platform_device *pdev, void *priv)return ret; } -static void *socfpga_dwmac_probe (struct platform_device *pdev) +static int socfpga_dwmac_probe (struct platform_device *pdev) { +struct plat_stmmacenet_data *plat_dat; +struct stmmac_resources stmmac_res;struct device *dev = &pdev->dev;int ret;struct socfpga_dwmac *dwmac; + ret =stmmac_get_platform_resources (pdev, &stmmac_res); +if (ret) +return ret; + + plat_dat =stmmac_probe_config_dt (pdev, &stmmac_res.mac); +if (IS_ERR (plat_dat)) +return PTR_ERR (plat_dat); + dwmac =devm_kzalloc (dev,sizeof (*dwmac),GFP_KERNEL );if (!dwmac) -return ERR_PTR (-ENOMEM ); +return -ENOMEM ; ret =socfpga_dwmac_parse_data (dwmac, dev);if (ret) {dev_err (dev,"Unable to parse OF data\n" ); -return ERR_PTR (ret); +return ret; } ret =socfpga_dwmac_setup (dwmac);if (ret) {dev_err (dev,"couldn't setup SoC glue (%d)\n" , ret); -return ERR_PTR (ret); +return ret; } -return dwmac; -} + plat_dat->bsp_priv = dwmac; + plat_dat->init = socfpga_dwmac_init; + plat_dat->exit = socfpga_dwmac_exit; + plat_dat->fix_mac_speed = socfpga_dwmac_fix_mac_speed; -static const struct stmmac_of_data socfpga_gmac_data = { - .setup = socfpga_dwmac_probe, - .init = socfpga_dwmac_init, - .exit = socfpga_dwmac_exit, - .fix_mac_speed = socfpga_dwmac_fix_mac_speed, -}; + ret =socfpga_dwmac_init (pdev, plat_dat->bsp_priv); +if (ret) +return ret; + +return stmmac_dvr_probe (&pdev->dev, plat_dat, &stmmac_res); +}static const struct of_device_id socfpga_dwmac_match[] = { - { .compatible ="altr,socfpga-stmmac" , .data = &socfpga_gmac_data }, + { .compatible ="altr,socfpga-stmmac" }, { } };MODULE_DEVICE_TABLE (of, socfpga_dwmac_match);static struct platform_driver socfpga_dwmac_driver = { - .probe = stmmac_pltfr_probe, + .probe = socfpga_dwmac_probe, .remove = stmmac_pltfr_remove, .driver = { .name ="socfpga-dwmac" ,
Signature · 1 line
1.8.0
PATCH 6/17 stmmac: dwmac-sunxi: move sun7i_gmac_setup function
In reply to Joachim EastwoodMove sun7i_gmac_setup in preparation for turning it into a proper probe function.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c | 58 +++++++++++------------ 1 file changed, 29 insertions(+), 29 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c +29 -29
@@ -33,35 +33,6 @@ struct sunxi_priv_data {struct regulator *regulator; }; -static void *sun7i_gmac_setup (struct platform_device *pdev) -{ -struct sunxi_priv_data *gmac; -struct device *dev = &pdev->dev; - - gmac =devm_kzalloc (dev,sizeof (*gmac),GFP_KERNEL ); -if (!gmac) -return ERR_PTR (-ENOMEM ); - - gmac->interface =of_get_phy_mode (dev->of_node); - - gmac->tx_clk =devm_clk_get (dev,"allwinner_gmac_tx" ); -if (IS_ERR (gmac->tx_clk)) { -dev_err (dev,"could not get tx clock\n" ); -return gmac->tx_clk; - } - -/* Optional regulator for PHY */ - gmac->regulator =devm_regulator_get_optional (dev,"phy" ); -if (IS_ERR (gmac->regulator)) { -if (PTR_ERR (gmac->regulator) == -EPROBE_DEFER ) -return ERR_PTR (-EPROBE_DEFER ); -dev_info (dev,"no regulator found\n" ); - gmac->regulator =NULL ; - } - -return gmac; -} -#define SUN7I_GMAC_GMII_RGMII_RATE 125000000#define SUN7I_GMAC_MII_RATE 25000000
@@ -132,6 +103,35 @@ static void sun7i_fix_speed(void *priv, unsigned int speed) } } +static void *sun7i_gmac_setup (struct platform_device *pdev) +{ +struct sunxi_priv_data *gmac; +struct device *dev = &pdev->dev; + + gmac =devm_kzalloc (dev,sizeof (*gmac),GFP_KERNEL ); +if (!gmac) +return ERR_PTR (-ENOMEM ); + + gmac->interface =of_get_phy_mode (dev->of_node); + + gmac->tx_clk =devm_clk_get (dev,"allwinner_gmac_tx" ); +if (IS_ERR (gmac->tx_clk)) { +dev_err (dev,"could not get tx clock\n" ); +return gmac->tx_clk; + } + +/* Optional regulator for PHY */ + gmac->regulator =devm_regulator_get_optional (dev,"phy" ); +if (IS_ERR (gmac->regulator)) { +if (PTR_ERR (gmac->regulator) == -EPROBE_DEFER ) +return ERR_PTR (-EPROBE_DEFER ); +dev_info (dev,"no regulator found\n" ); + gmac->regulator =NULL ; + } + +return gmac; +} +/* of_data specifying hardware features and callbacks. * hardware features were copied from Allwinner drivers. */ static const struct stmmac_of_data sun7i_gmac_data = {
Signature · 1 line
1.8.0
PATCH 7/17 stmmac: dwmac-sunxi: turn setup callback into a probe function
In reply to Joachim EastwoodBy using a few functions from stmmac_platform a proper probe function can be created from the setup glue callback. This makes it look more like a standard driver and the OF match data can also be dropped.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c | 49 ++++++++++++++--------- 1 file changed, 31 insertions(+), 18 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c +31 -18
@@ -103,54 +103,67 @@ static void sun7i_fix_speed(void *priv, unsigned int speed) } } -static void *sun7i_gmac_setup (struct platform_device *pdev) +static int sun7i_gmac_probe (struct platform_device *pdev) { +struct plat_stmmacenet_data *plat_dat; +struct stmmac_resources stmmac_res;struct sunxi_priv_data *gmac;struct device *dev = &pdev->dev; +int ret; + + ret =stmmac_get_platform_resources (pdev, &stmmac_res); +if (ret) +return ret; + + plat_dat =stmmac_probe_config_dt (pdev, &stmmac_res.mac); +if (IS_ERR (plat_dat)) +return PTR_ERR (plat_dat); gmac =devm_kzalloc (dev,sizeof (*gmac),GFP_KERNEL );if (!gmac) -return ERR_PTR (-ENOMEM ); +return -ENOMEM ; gmac->interface =of_get_phy_mode (dev->of_node); gmac->tx_clk =devm_clk_get (dev,"allwinner_gmac_tx" );if (IS_ERR (gmac->tx_clk)) {dev_err (dev,"could not get tx clock\n" ); -return gmac->tx_clk; +return PTR_ERR (gmac->tx_clk); }/* Optional regulator for PHY */ gmac->regulator =devm_regulator_get_optional (dev,"phy" );if (IS_ERR (gmac->regulator)) {if (PTR_ERR (gmac->regulator) == -EPROBE_DEFER ) -return ERR_PTR (-EPROBE_DEFER ); +return -EPROBE_DEFER ;dev_info (dev,"no regulator found\n" ); gmac->regulator =NULL ; } -return gmac; -} +/* platform data specifying hardware features and callbacks. +* hardware features were copied from Allwinner drivers. */ + plat_dat->tx_coe =1 ; + plat_dat->has_gmac = true; + plat_dat->bsp_priv = gmac; + plat_dat->init = sun7i_gmac_init; + plat_dat->exit = sun7i_gmac_exit; + plat_dat->fix_mac_speed = sun7i_fix_speed; -/* of_data specifying hardware features and callbacks. -* hardware features were copied from Allwinner drivers. */ -static const struct stmmac_of_data sun7i_gmac_data = { - .has_gmac =1 , - .tx_coe =1 , - .fix_mac_speed = sun7i_fix_speed, - .setup = sun7i_gmac_setup, - .init = sun7i_gmac_init, - .exit = sun7i_gmac_exit, -}; + ret =sun7i_gmac_init (pdev, plat_dat->bsp_priv); +if (ret) +return ret; + +return stmmac_dvr_probe (&pdev->dev, plat_dat, &stmmac_res); +}static const struct of_device_id sun7i_dwmac_match[] = { - { .compatible ="allwinner,sun7i-a20-gmac" , .data = &sun7i_gmac_data}, + { .compatible ="allwinner,sun7i-a20-gmac" }, { } };MODULE_DEVICE_TABLE (of, sun7i_dwmac_match);static struct platform_driver sun7i_dwmac_driver = { - .probe = stmmac_pltfr_probe, + .probe = sun7i_gmac_probe, .remove = stmmac_pltfr_remove, .driver = { .name ="sun7i-dwmac" ,
Signature · 1 line
1.8.0
PATCH 8/17 stmmac: dwmac-sti: turn setup callback into a probe function
In reply to Joachim EastwoodBy using a few functions from stmmac_platform a proper probe function can be created from the setup glue callback. This makes it look more like a standard driver and prepares the driver for further clean ups.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c | 31 ++++++++++++++++++------- 1 file changed, 22 insertions(+), 9 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c +22 -9
@@ -334,36 +334,49 @@ static int sti_dwmac_parse_data(struct sti_dwmac *dwmac,return 0 ; } -static void *sti_dwmac_setup (struct platform_device *pdev) +static int sti_dwmac_probe (struct platform_device *pdev) { +struct plat_stmmacenet_data *plat_dat; +struct stmmac_resources stmmac_res;struct sti_dwmac *dwmac;int ret; + ret =stmmac_get_platform_resources (pdev, &stmmac_res); +if (ret) +return ret; + + plat_dat =stmmac_probe_config_dt (pdev, &stmmac_res.mac); +if (IS_ERR (plat_dat)) +return PTR_ERR (plat_dat); + dwmac =devm_kzalloc (&pdev->dev,sizeof (*dwmac),GFP_KERNEL );if (!dwmac) -return ERR_PTR (-ENOMEM ); +return -ENOMEM ; ret =sti_dwmac_parse_data (dwmac, pdev);if (ret) {dev_err (&pdev->dev,"Unable to parse OF data\n" ); -return ERR_PTR (ret); +return ret; } -return dwmac; + plat_dat->bsp_priv = dwmac; + plat_dat->exit = sti_dwmac_exit; + + ret = plat_dat->init (pdev, plat_dat->bsp_priv); +if (ret) +return ret; + +return stmmac_dvr_probe (&pdev->dev, plat_dat, &stmmac_res); }static const struct stmmac_of_data stih4xx_dwmac_data = { .fix_mac_speed = stih4xx_fix_retime_src, - .setup = sti_dwmac_setup, .init = stix4xx_init, - .exit = sti_dwmac_exit, };static const struct stmmac_of_data stid127_dwmac_data = { .fix_mac_speed = stid127_fix_retime_src, - .setup = sti_dwmac_setup, .init = stid127_init, - .exit = sti_dwmac_exit, };static const struct of_device_id sti_dwmac_match[] = {
@@ -376,7 +389,7 @@ static const struct of_device_id sti_dwmac_match[] = {MODULE_DEVICE_TABLE (of, sti_dwmac_match);static struct platform_driver sti_dwmac_driver = { - .probe = stmmac_pltfr_probe, + .probe = sti_dwmac_probe, .remove = stmmac_pltfr_remove, .driver = { .name ="sti-dwmac" ,
Signature · 1 line
1.8.0
PATCH 10/17 stmmac: move stmmac_pltfr_probe into dwmac-generic
In reply to Joachim EastwoodAs all dwmac-* drivers now have their own probe function move the common one into dwmac-generic driver and drop the EXPORT.
--- .../net/ethernet/stmicro/stmmac/dwmac-generic.c | 49 ++++++++++++++++++- .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 55 ---------------------- .../net/ethernet/stmicro/stmmac/stmmac_platform.h | 1 - 3 files changed, 48 insertions(+), 57 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c +48 -1
@@ -16,6 +16,53 @@#include "stmmac.h" #include "stmmac_platform.h" +static int dwmac_generic_probe (struct platform_device *pdev) +{ +struct plat_stmmacenet_data *plat_dat; +struct stmmac_resources stmmac_res; +int ret; + + ret =stmmac_get_platform_resources (pdev, &stmmac_res); +if (ret) +return ret; + +if (pdev->dev.of_node) { + plat_dat =stmmac_probe_config_dt (pdev, &stmmac_res.mac); +if (IS_ERR (plat_dat)) { +dev_err (&pdev->dev,"dt configuration failed\n" ); +return PTR_ERR (plat_dat); + } + }else { + plat_dat =dev_get_platdata (&pdev->dev); +if (!plat_dat) { +dev_err (&pdev->dev,"no platform data provided\n" ); +return -EINVAL ; + } + +/* Set default value for multicast hash bins */ + plat_dat->multicast_filter_bins =HASH_TABLE_SIZE ; + +/* Set default value for unicast filter entries */ + plat_dat->unicast_filter_entries =1 ; + } + +/* Custom setup (if needed) */ +if (plat_dat->setup) { + plat_dat->bsp_priv = plat_dat->setup (pdev); +if (IS_ERR (plat_dat->bsp_priv)) +return PTR_ERR (plat_dat->bsp_priv); + } + +/* Custom initialisation (if needed) */ +if (plat_dat->init) { + ret = plat_dat->init (pdev, plat_dat->bsp_priv); +if (ret) +return ret; + } + +return stmmac_dvr_probe (&pdev->dev, plat_dat, &stmmac_res); +} +static const struct of_device_id dwmac_generic_match[] = { { .compatible ="st,spear600-gmac" }, { .compatible ="snps,dwmac-3.610" },
@@ -27,7 +74,7 @@ static const struct of_device_id dwmac_generic_match[] = {MODULE_DEVICE_TABLE (of, dwmac_generic_match);static struct platform_driver dwmac_generic_driver = { - .probe = stmmac_pltfr_probe, + .probe = dwmac_generic_probe, .remove = stmmac_pltfr_remove, .driver = { .name =STMMAC_RESOURCE_NAME ,
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +0 -55
61 lines not on this page · raw message
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h +0 -1
@@ -27,7 +27,6 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac);int stmmac_get_platform_resources (struct platform_device *pdev,struct stmmac_resources *stmmac_res); -int stmmac_pltfr_probe (struct platform_device *pdev);int stmmac_pltfr_remove (struct platform_device *pdev);extern const struct dev_pm_ops stmmac_pltfr_pm_ops;
Signature · 1 line
1.8.0
PATCH 11/17 stmmac: let dwmac-* drivers handle their own match data
In reply to Joachim EastwoodSince only a few of the dwmac-* drivers actually need to use the OF match move handling into the dwmac-* drivers that need it. This will also allow dwmac-* drivers to use their own custom match data structure.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 8 ++++++++ drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c | 10 ++++++++++ drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 18 ------------------ 3 files changed, 18 insertions(+), 18 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +8 -0
@@ -580,8 +580,15 @@ static int rk_gmac_probe(struct platform_device *pdev) {struct plat_stmmacenet_data *plat_dat;struct stmmac_resources stmmac_res; +const struct stmmac_of_data *data;int ret; + data =of_device_get_match_data (&pdev->dev); +if (!data) { +dev_err (&pdev->dev,"no of match data provided\n" ); +return -EINVAL ; + } + ret =stmmac_get_platform_resources (pdev, &stmmac_res);if (ret)return ret;
@@ -591,6 +598,7 @@ static int rk_gmac_probe(struct platform_device *pdev)return PTR_ERR (plat_dat); plat_dat->has_gmac = true; + plat_dat->setup = data->setup; plat_dat->init = rk_gmac_init; plat_dat->exit = rk_gmac_exit; plat_dat->fix_mac_speed = rk_fix_speed;
drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c +10 -0
@@ -21,6 +21,7 @@#include <linux/regmap.h> #include <linux/clk.h> #include <linux/of.h> +#include <linux/of_device.h> #include <linux/of_net.h> #include "stmmac_platform.h"
@@ -337,10 +338,17 @@ static int sti_dwmac_parse_data(struct sti_dwmac *dwmac,static int sti_dwmac_probe (struct platform_device *pdev) {struct plat_stmmacenet_data *plat_dat; +const struct stmmac_of_data *data;struct stmmac_resources stmmac_res;struct sti_dwmac *dwmac;int ret; + data =of_device_get_match_data (&pdev->dev); +if (!data) { +dev_err (&pdev->dev,"No OF match data provided\n" ); +return -EINVAL ; + } + ret =stmmac_get_platform_resources (pdev, &stmmac_res);if (ret)return ret;
@@ -360,7 +368,9 @@ static int sti_dwmac_probe(struct platform_device *pdev) } plat_dat->bsp_priv = dwmac; + plat_dat->init = data->init; plat_dat->exit = sti_dwmac_exit; + plat_dat->fix_mac_speed = data->fix_mac_speed; ret = plat_dat->init (pdev, plat_dat->bsp_priv);if (ret)
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +0 -18
@@ -109,30 +109,12 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) {struct device_node *np = pdev->dev.of_node;struct plat_stmmacenet_data *plat; -const struct stmmac_of_data *data;struct stmmac_dma_cfg *dma_cfg; plat =devm_kzalloc (&pdev->dev,sizeof (*plat),GFP_KERNEL );if (!plat)return ERR_PTR (-ENOMEM ); - data =of_device_get_match_data (&pdev->dev); -if (data) { - plat->has_gmac = data->has_gmac; - plat->enh_desc = data->enh_desc; - plat->tx_coe = data->tx_coe; - plat->rx_coe = data->rx_coe; - plat->bugged_jumbo = data->bugged_jumbo; - plat->pmt = data->pmt; - plat->riwt_off = data->riwt_off; - plat->fix_mac_speed = data->fix_mac_speed; - plat->bus_setup = data->bus_setup; - plat->setup = data->setup; - plat->free = data->free; - plat->init = data->init; - plat->exit = data->exit; - } - *mac =of_get_mac_address (np); plat->interface =of_get_phy_mode (np);
Signature · 1 line
1.8.0
PATCH 12/17 stmmac: dwmac-sti: use custom of match structure
In reply to Joachim EastwoodCreate a new private structure for OF match data in the dwmac-sti driver. This enables us to eventually drop the common OF match data structure which contains a lot of unused fields.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c +8 -3
@@ -131,6 +131,11 @@ struct sti_dwmac {u32 speed; }; +struct sti_dwmac_of_data { +void (*fix_mac_speed)(void *priv,unsigned int speed); +int (*init)(struct platform_device *pdev,void *priv); +}; +static u32 phy_intf_sels[] = { [PHY_INTERFACE_MODE_MII ] =ETH_PHY_SEL_MII , [PHY_INTERFACE_MODE_GMII ] =ETH_PHY_SEL_GMII ,
@@ -338,7 +343,7 @@ static int sti_dwmac_parse_data(struct sti_dwmac *dwmac,static int sti_dwmac_probe (struct platform_device *pdev) {struct plat_stmmacenet_data *plat_dat; -const struct stmmac_of_data *data; +const struct sti_dwmac_of_data *data;struct stmmac_resources stmmac_res;struct sti_dwmac *dwmac;int ret;
@@ -379,12 +384,12 @@ static int sti_dwmac_probe(struct platform_device *pdev)return stmmac_dvr_probe (&pdev->dev, plat_dat, &stmmac_res); } -static const struct stmmac_of_data stih4xx_dwmac_data = { +static const struct sti_dwmac_of_data stih4xx_dwmac_data = { .fix_mac_speed = stih4xx_fix_retime_src, .init = stix4xx_init, }; -static const struct stmmac_of_data stid127_dwmac_data = { +static const struct sti_dwmac_of_data stid127_dwmac_data = { .fix_mac_speed = stid127_fix_retime_src, .init = stid127_init, };
Signature · 1 line
1.8.0
PATCH 14/17 stmmac: dwmac-rk: use rk_gmac_ops as of match data
In reply to Joachim EastwoodRemove the setup glue callback and use rk_gmac_ops as OF match data so it can used directly when calling rk_gmac_setup.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 27 ++++---------------------- 1 file changed, 4 insertions(+), 23 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +4 -23
@@ -529,16 +529,6 @@ static struct rk_priv_data *rk_gmac_setup(struct platform_device *pdev,return bsp_priv; } -static void *rk3288_gmac_setup (struct platform_device *pdev) -{ -return rk_gmac_setup (pdev, &rk3288_ops); -} - -static void *rk3368_gmac_setup (struct platform_device *pdev) -{ -return rk_gmac_setup (pdev, &rk3368_ops); -} -static int rk_gmac_init (struct platform_device *pdev,void *priv) {struct rk_priv_data *bsp_priv = priv;
@@ -580,7 +570,7 @@ static int rk_gmac_probe(struct platform_device *pdev) {struct plat_stmmacenet_data *plat_dat;struct stmmac_resources stmmac_res; -const struct stmmac_of_data *data; +const struct rk_gmac_ops *data;int ret; data =of_device_get_match_data (&pdev->dev);
@@ -598,12 +588,11 @@ static int rk_gmac_probe(struct platform_device *pdev)return PTR_ERR (plat_dat); plat_dat->has_gmac = true; - plat_dat->setup = data->setup; plat_dat->init = rk_gmac_init; plat_dat->exit = rk_gmac_exit; plat_dat->fix_mac_speed = rk_fix_speed; - plat_dat->bsp_priv = plat_dat->setup (pdev); + plat_dat->bsp_priv =rk_gmac_setup (pdev, data);if (IS_ERR (plat_dat->bsp_priv))return PTR_ERR (plat_dat->bsp_priv);
@@ -614,17 +603,9 @@ static int rk_gmac_probe(struct platform_device *pdev)return stmmac_dvr_probe (&pdev->dev, plat_dat, &stmmac_res); } -static const struct stmmac_of_data rk3288_gmac_data = { - .setup = rk3288_gmac_setup, -}; - -static const struct stmmac_of_data rk3368_gmac_data = { - .setup = rk3368_gmac_setup, -}; -static const struct of_device_id rk_gmac_dwmac_match[] = { - { .compatible ="rockchip,rk3288-gmac" , .data = &rk3288_gmac_data}, - { .compatible ="rockchip,rk3368-gmac" , .data = &rk3368_gmac_data}, + { .compatible ="rockchip,rk3288-gmac" , .data = &rk3288_ops }, + { .compatible ="rockchip,rk3368-gmac" , .data = &rk3368_ops }, { } };MODULE_DEVICE_TABLE (of, rk_gmac_dwmac_match);
Signature · 1 line
1.8.0
PATCH 15/17 stmmac: remove unused stmmac_of_data struct
In reply to Joachim EastwoodAs dwmac-* drivers that need OF match have been converted to use their own internal OF match data structure this can now be removed.
--- Documentation/networking/stmmac.txt | 2 -- include/linux/stmmac.h | 18 ------------------ 2 files changed, 20 deletions(-)
Documentation/networking/stmmac.txt +0 -2
@@ -274,8 +274,6 @@ capability register can replace what has been passed from the platform. Please see the following document: Documentation/devicetree/bindings/net/stmmac.txt -and the stmmac_of_data structure inside the include/linux/stmmac.h header file. - 4.11) This is a summary of the content of some relevant files: o stmmac_main.c: to implement the main network device driver; o stmmac_mdio.c: to provide mdio functions;
include/linux/stmmac.h +0 -18
@@ -125,22 +125,4 @@ struct plat_stmmacenet_data {void (*exit)(struct platform_device *pdev,void *priv); void *bsp_priv; }; - -/* of_data for SoC glue layer device tree bindings */ - -struct stmmac_of_data { -int has_gmac; -int enh_desc; -int tx_coe; -int rx_coe; -int bugged_jumbo; -int pmt; -int riwt_off; -void (*fix_mac_speed)(void *priv,unsigned int speed); -void (*bus_setup)(void __iomem *ioaddr); -void *(*setup)(struct platform_device *pdev); -void (*free)(struct platform_device *pdev,void *priv); -int (*init)(struct platform_device *pdev,void *priv); -void (*exit)(struct platform_device *pdev,void *priv); -};#endif
Signature · 1 line
1.8.0
PATCH 16/17 stmmac: remove setup/free glue callbacks
In reply to Joachim EastwoodAs all dwmac-* drivers have been converted to have a proper probe function the setup callback can now be removed. Also remove the free callback that wasn't used by any driver.
New dwmac-* drivers should implement standard probe and remove functions to preform any needed setup and teardown.
--- Documentation/networking/stmmac.txt | 8 ++------ drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c | 7 ------- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 3 --- include/linux/stmmac.h | 2 -- 4 files changed, 2 insertions(+), 18 deletions(-)
Documentation/networking/stmmac.txt +2 -6
@@ -135,8 +135,6 @@ struct plat_stmmacenet_data { int maxmtu; void (*fix_mac_speed)(void *priv, unsigned int speed); void (*bus_setup)(void __iomem *ioaddr); - void *(*setup)(struct platform_device *pdev); - void (*free)(struct platform_device *pdev, void *priv); int (*init)(struct platform_device *pdev, void *priv); void (*exit)(struct platform_device *pdev, void *priv); void *bsp_priv;
@@ -177,12 +175,10 @@ Where: o bus_setup: perform HW setup of the bus. For example, on some ST platforms this field is used to configure the AMBA bridge to generate more efficient STBus traffic. - o setup/init/exit: callbacks used for calling a custom initialization; + o init/exit: callbacks used for calling a custom initialization; this is sometime necessary on some platforms (e.g. ST boxes) where the HW needs to have set some PIO lines or system cfg - registers. setup should return a pointer to private data, - which will be stored in bsp_priv, and then passed to init and - exit callbacks. init/exit callbacks should not use or modify + registers. init/exit callbacks should not use or modify platform data. o bsp_priv: another private pointer.
drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c +0 -7
@@ -46,13 +46,6 @@ static int dwmac_generic_probe(struct platform_device *pdev) plat_dat->unicast_filter_entries =1 ; } -/* Custom setup (if needed) */ -if (plat_dat->setup) { - plat_dat->bsp_priv = plat_dat->setup (pdev); -if (IS_ERR (plat_dat->bsp_priv)) -return PTR_ERR (plat_dat->bsp_priv); - } -/* Custom initialisation (if needed) */ if (plat_dat->init) { ret = plat_dat->init (pdev, plat_dat->bsp_priv);
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +0 -3
@@ -300,9 +300,6 @@ int stmmac_pltfr_remove(struct platform_device *pdev)if (priv->plat->exit) priv->plat->exit (pdev, priv->plat->bsp_priv); -if (priv->plat->free) - priv->plat->free (pdev, priv->plat->bsp_priv); -return ret; }EXPORT_SYMBOL_GPL (stmmac_pltfr_remove);
include/linux/stmmac.h +0 -2
@@ -119,8 +119,6 @@ struct plat_stmmacenet_data {int rx_fifo_size;void (*fix_mac_speed)(void *priv,unsigned int speed);void (*bus_setup)(void __iomem *ioaddr); -void *(*setup)(struct platform_device *pdev); -void (*free)(struct platform_device *pdev,void *priv);int (*init)(struct platform_device *pdev,void *priv);void (*exit)(struct platform_device *pdev,void *priv);void *bsp_priv;
Signature · 1 line
1.8.0
PATCH 17/17 stmmac: dwmac-sti: refactor the init glue callbacks
In reply to Joachim EastwoodRemove the two platform specific init callbacks and make them use a common one by creating a function member in the internal data structure. This allow us to remove the layer of indirection and simplify the code a bit.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c | 43 +++++++------------------ 1 file changed, 12 insertions(+), 31 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c +12 -31
@@ -129,11 +129,11 @@ struct sti_dwmac {struct device *dev;struct regmap *regmap;u32 speed; +void (*fix_retime_src)(void *priv,unsigned int speed); };struct sti_dwmac_of_data { -void (*fix_mac_speed)(void *priv,unsigned int speed); -int (*init)(struct platform_device *pdev,void *priv); +void (*fix_retime_src)(void *priv,unsigned int speed); };static u32 phy_intf_sels[] = {
@@ -228,8 +228,9 @@ static void stid127_fix_retime_src(void *priv, u32 spd)regmap_update_bits (dwmac->regmap, reg,STID127_RETIME_SRC_MASK , val); } -static void sti_dwmac_ctrl_init (struct sti_dwmac *dwmac) +static int sti_dwmac_init (struct platform_device *pdev,void *priv) { +struct sti_dwmac *dwmac = priv;struct regmap *regmap = dwmac->regmap;int iface = dwmac->interface;struct device *dev = dwmac->dev;
@@ -247,28 +248,8 @@ static void sti_dwmac_ctrl_init(struct sti_dwmac *dwmac) val = (iface ==PHY_INTERFACE_MODE_REVMII ) ?0 :ENMII ;regmap_update_bits (regmap, reg,ENMII_MASK , val); -} - -static int stix4xx_init (struct platform_device *pdev,void *priv) -{ -struct sti_dwmac *dwmac = priv; -u32 spd = dwmac->speed; - -sti_dwmac_ctrl_init (dwmac); -stih4xx_fix_retime_src (priv, spd); - -return 0 ; -} - -static int stid127_init (struct platform_device *pdev,void *priv) -{ -struct sti_dwmac *dwmac = priv; -u32 spd = dwmac->speed; - -sti_dwmac_ctrl_init (dwmac); - -stid127_fix_retime_src (priv, spd); + dwmac->fix_retime_src (priv, dwmac->speed);return 0 ; }
@@ -372,12 +353,14 @@ static int sti_dwmac_probe(struct platform_device *pdev)return ret; } + dwmac->fix_retime_src = data->fix_retime_src; + plat_dat->bsp_priv = dwmac; - plat_dat->init = data->init; + plat_dat->init = sti_dwmac_init; plat_dat->exit = sti_dwmac_exit; - plat_dat->fix_mac_speed = data->fix_mac_speed; + plat_dat->fix_mac_speed = data->fix_retime_src; - ret = plat_dat->init (pdev, plat_dat->bsp_priv); + ret =sti_dwmac_init (pdev, plat_dat->bsp_priv);if (ret)return ret;
@@ -385,13 +368,11 @@ static int sti_dwmac_probe(struct platform_device *pdev) }static const struct sti_dwmac_of_data stih4xx_dwmac_data = { - .fix_mac_speed = stih4xx_fix_retime_src, - .init = stix4xx_init, + .fix_retime_src = stih4xx_fix_retime_src, };static const struct sti_dwmac_of_data stid127_dwmac_data = { - .fix_mac_speed = stid127_fix_retime_src, - .init = stid127_init, + .fix_retime_src = stid127_fix_retime_src, };static const struct of_device_id sti_dwmac_match[] = {
Signature · 1 line
1.8.0
David Miller
maintainerFrom: Joachim Eastwood <[email protected]>
Date: Wed, 29 Jul 2015 00:08:47 +0200
Quoted 4 lines
This patch set creates proper probe functions in the remaining dwmac-* drivers, lets the drivers manage their own of match data structure, and cleans up some of the drivers a bit. Note that should be no functional change in any of the drivers.
This is a really nice set of simplifications, series applied, thanks.
Please follow up on any breakage reported, thanks.