aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2017-01-02 06:56:04 -0500
committerDavid S. Miller <davem@davemloft.net>2017-01-03 09:33:00 -0500
commita8de4d719dfc12bc22192d7daef7c7ae6cfb8b80 (patch)
treee73506edb228b80ff7f17a678077ebc38d55e235
parent6b4c212b95ce6a586473a772fb2d28ab22a38f0e (diff)
net: stmmac: dwmac-oxnas: use generic pm implementation
Now that we have an exit callback in place, add init as well and get rid of the custom PM callbacks in favour of the generic ones. Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c38
1 files changed, 5 insertions, 33 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c
index 3efd110613df..3dc7d279f805 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c
@@ -60,8 +60,9 @@ struct oxnas_dwmac {
60 struct regmap *regmap; 60 struct regmap *regmap;
61}; 61};
62 62
63static int oxnas_dwmac_init(struct oxnas_dwmac *dwmac) 63static int oxnas_dwmac_init(struct platform_device *pdev, void *priv)
64{ 64{
65 struct oxnas_dwmac *dwmac = priv;
65 unsigned int value; 66 unsigned int value;
66 int ret; 67 int ret;
67 68
@@ -135,6 +136,7 @@ static int oxnas_dwmac_probe(struct platform_device *pdev)
135 136
136 dwmac->dev = &pdev->dev; 137 dwmac->dev = &pdev->dev;
137 plat_dat->bsp_priv = dwmac; 138 plat_dat->bsp_priv = dwmac;
139 plat_dat->init = oxnas_dwmac_init;
138 plat_dat->exit = oxnas_dwmac_exit; 140 plat_dat->exit = oxnas_dwmac_exit;
139 141
140 dwmac->regmap = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, 142 dwmac->regmap = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
@@ -151,7 +153,7 @@ static int oxnas_dwmac_probe(struct platform_device *pdev)
151 goto err_remove_config_dt; 153 goto err_remove_config_dt;
152 } 154 }
153 155
154 ret = oxnas_dwmac_init(dwmac); 156 ret = oxnas_dwmac_init(pdev, plat_dat->bsp_priv);
155 if (ret) 157 if (ret)
156 goto err_remove_config_dt; 158 goto err_remove_config_dt;
157 159
@@ -170,36 +172,6 @@ err_remove_config_dt:
170 return ret; 172 return ret;
171} 173}
172 174
173#ifdef CONFIG_PM_SLEEP
174static int oxnas_dwmac_suspend(struct device *dev)
175{
176 struct oxnas_dwmac *dwmac = get_stmmac_bsp_priv(dev);
177 int ret;
178
179 ret = stmmac_suspend(dev);
180 clk_disable_unprepare(dwmac->clk);
181
182 return ret;
183}
184
185static int oxnas_dwmac_resume(struct device *dev)
186{
187 struct oxnas_dwmac *dwmac = get_stmmac_bsp_priv(dev);
188 int ret;
189
190 ret = oxnas_dwmac_init(dwmac);
191 if (ret)
192 return ret;
193
194 ret = stmmac_resume(dev);
195
196 return ret;
197}
198#endif /* CONFIG_PM_SLEEP */
199
200static SIMPLE_DEV_PM_OPS(oxnas_dwmac_pm_ops,
201 oxnas_dwmac_suspend, oxnas_dwmac_resume);
202
203static const struct of_device_id oxnas_dwmac_match[] = { 175static const struct of_device_id oxnas_dwmac_match[] = {
204 { .compatible = "oxsemi,ox820-dwmac" }, 176 { .compatible = "oxsemi,ox820-dwmac" },
205 { } 177 { }
@@ -211,7 +183,7 @@ static struct platform_driver oxnas_dwmac_driver = {
211 .remove = stmmac_pltfr_remove, 183 .remove = stmmac_pltfr_remove,
212 .driver = { 184 .driver = {
213 .name = "oxnas-dwmac", 185 .name = "oxnas-dwmac",
214 .pm = &oxnas_dwmac_pm_ops, 186 .pm = &stmmac_pltfr_pm_ops,
215 .of_match_table = oxnas_dwmac_match, 187 .of_match_table = oxnas_dwmac_match,
216 }, 188 },
217}; 189};