All of lore.kernel.org
 help / color / mirror / Atom feed
* [net-next 1/2] stmmac: use custom init/exit functions in pm ops
@ 2012-04-18  8:28 Giuseppe CAVALLARO
  2012-04-18  8:28 ` [net-next 2/2] stmmac: Move the mdio_register/_unregister in probe/remove Giuseppe CAVALLARO
  2012-04-18  8:45 ` [net-next 1/2] stmmac: use custom init/exit functions in pm ops David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Giuseppe CAVALLARO @ 2012-04-18  8:28 UTC (permalink / raw)
  To: netdev; +Cc: Francesco Virlinzi, Giuseppe Cavallaro

From: Francesco Virlinzi <francesco.virlinzi@st.com>

Freeze and restore can call the custom init/exit functions.
Also the patch adds a custom data field that can be used
for storing platform data useful on restore the embedded
setup (e.g. GPIO, SYSCFG).

Signed-off-by: Francesco Virlinzi <francesco.virlinzi@st.com>
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
---
 .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |   17 +++++++++++++----
 include/linux/stmmac.h                             |    1 +
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 12bd221..ba30d38 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -189,9 +189,6 @@ static int stmmac_pltfr_remove(struct platform_device *pdev)
 	if (priv->plat->exit)
 		priv->plat->exit(pdev);
 
-	if (priv->plat->exit)
-		priv->plat->exit(pdev);
-
 	platform_set_drvdata(pdev, NULL);
 
 	iounmap((void *)priv->ioaddr);
@@ -218,14 +215,26 @@ static int stmmac_pltfr_resume(struct device *dev)
 
 int stmmac_pltfr_freeze(struct device *dev)
 {
+	int ret;
+	struct plat_stmmacenet_data *plat_dat = dev_get_platdata(dev);
 	struct net_device *ndev = dev_get_drvdata(dev);
+	struct platform_device *pdev = to_platform_device(dev);
 
-	return stmmac_freeze(ndev);
+	ret = stmmac_freeze(ndev);
+	if (plat_dat->exit)
+		plat_dat->exit(pdev);
+
+	return ret;
 }
 
 int stmmac_pltfr_restore(struct device *dev)
 {
+	struct plat_stmmacenet_data *plat_dat = dev_get_platdata(dev);
 	struct net_device *ndev = dev_get_drvdata(dev);
+	struct platform_device *pdev = to_platform_device(dev);
+
+	if (plat_dat->init)
+		plat_dat->init(pdev);
 
 	return stmmac_restore(ndev);
 }
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index cf64031..f85c93d 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -109,6 +109,7 @@ struct plat_stmmacenet_data {
 	int (*init)(struct platform_device *pdev);
 	void (*exit)(struct platform_device *pdev);
 	void *custom_cfg;
+	void *custom_data;
 	void *bsp_priv;
 };
 #endif
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [net-next 2/2] stmmac: Move the mdio_register/_unregister in probe/remove
  2012-04-18  8:28 [net-next 1/2] stmmac: use custom init/exit functions in pm ops Giuseppe CAVALLARO
@ 2012-04-18  8:28 ` Giuseppe CAVALLARO
  2012-04-18  8:45 ` [net-next 1/2] stmmac: use custom init/exit functions in pm ops David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: Giuseppe CAVALLARO @ 2012-04-18  8:28 UTC (permalink / raw)
  To: netdev; +Cc: Francesco Virlinzi

From: Francesco Virlinzi <francesco.virlinzi@st.com>

This patch moves the mdio_register/_unregister in probe/remove
functions and this also is required when hibernation on disk
is done.

Signed-off-by: Francesco Virlinzi <francesco.virlinzi@st,com>
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st,com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index a64f0d4..b6dce8f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -937,14 +937,6 @@ static int stmmac_open(struct net_device *dev)
 
 	stmmac_check_ether_addr(priv);
 
-	/* MDIO bus Registration */
-	ret = stmmac_mdio_register(dev);
-	if (ret < 0) {
-		pr_debug("%s: MDIO bus (id: %d) registration failed",
-			 __func__, priv->plat->bus_id);
-		goto open_clk_dis;
-	}
-
 #ifdef CONFIG_STMMAC_TIMER
 	priv->tm = kzalloc(sizeof(struct stmmac_timer *), GFP_KERNEL);
 	if (unlikely(priv->tm == NULL)) {
@@ -1067,7 +1059,9 @@ open_error:
 	if (priv->phydev)
 		phy_disconnect(priv->phydev);
 
+#ifdef CONFIG_STMMAC_TIMER
 open_clk_dis:
+#endif
 	stmmac_clk_disable(priv);
 	return ret;
 }
@@ -1120,7 +1114,6 @@ static int stmmac_release(struct net_device *dev)
 #ifdef CONFIG_STMMAC_DEBUG_FS
 	stmmac_exit_fs();
 #endif
-	stmmac_mdio_unregister(dev);
 	stmmac_clk_disable(priv);
 
 	return 0;
@@ -1932,6 +1925,14 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
 	else
 		priv->clk_csr = priv->plat->clk_csr;
 
+	/* MDIO bus Registration */
+	ret = stmmac_mdio_register(ndev);
+	if (ret < 0) {
+		pr_debug("%s: MDIO bus (id: %d) registration failed",
+			 __func__, priv->plat->bus_id);
+		goto error;
+	}
+
 	return priv;
 
 error:
@@ -1959,6 +1960,7 @@ int stmmac_dvr_remove(struct net_device *ndev)
 	priv->hw->dma->stop_tx(priv->ioaddr);
 
 	stmmac_set_mac(priv->ioaddr, false);
+	stmmac_mdio_unregister(ndev);
 	netif_carrier_off(ndev);
 	unregister_netdev(ndev);
 	free_netdev(ndev);
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [net-next 1/2] stmmac: use custom init/exit functions in pm ops
  2012-04-18  8:28 [net-next 1/2] stmmac: use custom init/exit functions in pm ops Giuseppe CAVALLARO
  2012-04-18  8:28 ` [net-next 2/2] stmmac: Move the mdio_register/_unregister in probe/remove Giuseppe CAVALLARO
@ 2012-04-18  8:45 ` David Miller
  2012-04-18  9:07   ` Giuseppe CAVALLARO
  1 sibling, 1 reply; 4+ messages in thread
From: David Miller @ 2012-04-18  8:45 UTC (permalink / raw)
  To: peppe.cavallaro; +Cc: netdev, francesco.virlinzi


When posting new versions of patches, change the Subject line to
indicate this is "v2" or "v3" etc.

Also add comments after the "---" in the message body explaining what
you changed since the previous version.

But frankly Giuseppe, at this point I should NOT have to tell you crap
like this any more.  You should know how to submit patches properly
and not make things difficult for me.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [net-next 1/2] stmmac: use custom init/exit functions in pm ops
  2012-04-18  8:45 ` [net-next 1/2] stmmac: use custom init/exit functions in pm ops David Miller
@ 2012-04-18  9:07   ` Giuseppe CAVALLARO
  0 siblings, 0 replies; 4+ messages in thread
From: Giuseppe CAVALLARO @ 2012-04-18  9:07 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, francesco.virlinzi

On 4/18/2012 10:45 AM, David Miller wrote:
> 
> When posting new versions of patches, change the Subject line to
> indicate this is "v2" or "v3" etc.
> 
> Also add comments after the "---" in the message body explaining what
> you changed since the previous version.
> 
> But frankly Giuseppe, at this point I should NOT have to tell you crap
> like this any more.  You should know how to submit patches properly
> and not make things difficult for me.
> 

I had sent this morning these two patches for net.git and for net-next.
In fact in the latter the driver is aligned to Marc 2012.
In net.git the stmmac is aligned to Feb 2012.

In any case, do not consider these patches; I'll resend them plus some
new others soon.

Thx

Regards
Peppe

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-04-18  9:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-18  8:28 [net-next 1/2] stmmac: use custom init/exit functions in pm ops Giuseppe CAVALLARO
2012-04-18  8:28 ` [net-next 2/2] stmmac: Move the mdio_register/_unregister in probe/remove Giuseppe CAVALLARO
2012-04-18  8:45 ` [net-next 1/2] stmmac: use custom init/exit functions in pm ops David Miller
2012-04-18  9:07   ` Giuseppe CAVALLARO

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.