All of lore.kernel.org
 help / color / mirror / Atom feed
* [net-next PATCH 0/7] stmmac: dwmac-sti refactor+cleanup
@ 2016-10-30 20:05 Joachim Eastwood
  2016-10-30 20:05 ` [net-next PATCH 1/7] stmmac: dwmac-sti: remove useless of_node check Joachim Eastwood
                   ` (9 more replies)
  0 siblings, 10 replies; 15+ messages in thread
From: Joachim Eastwood @ 2016-10-30 20:05 UTC (permalink / raw)
  To: davem; +Cc: Joachim Eastwood, peppe.cavallaro, alexandre.torgue, netdev

This patch set aims to remove the init/exit callbacks from the 
dwmac-sti driver and instead use standard PM callbacks. Doing this
will also allow us to cleanup the driver.

Eventually the init/exit callbacks will be deprecated and removed
from all drivers dwmac-* except for dwmac-generic. Drivers will be
refactored to use standard PM and remove callbacks.

Note that this patch set has only been test compiled and no functional
change is intended.

Joachim Eastwood (7):
  stmmac: dwmac-sti: remove useless of_node check
  stmmac: dwmac-sti: remove clk NULL checks
  stmmac: dwmac-sti: add PM ops and resume function
  stmmac: dwmac-sti: move st,gmac_en parsing to sti_dwmac_parse_data
  stmmac: dwmac-sti: move clk_prepare_enable out of init and add error handling
  stmmac: dwmac-sti: clean up and rename sti_dwmac_init
  stmmac: dwmac-sti: remove unused priv dev member

 drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c | 86 ++++++++++++++++---------
 1 file changed, 57 insertions(+), 29 deletions(-)

-- 
2.10.1

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

* [net-next PATCH 1/7] stmmac: dwmac-sti: remove useless of_node check
  2016-10-30 20:05 [net-next PATCH 0/7] stmmac: dwmac-sti refactor+cleanup Joachim Eastwood
@ 2016-10-30 20:05 ` Joachim Eastwood
  2016-10-30 20:05 ` [net-next PATCH 2/7] stmmac: dwmac-sti: remove clk NULL checks Joachim Eastwood
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Joachim Eastwood @ 2016-10-30 20:05 UTC (permalink / raw)
  To: davem; +Cc: Joachim Eastwood, peppe.cavallaro, alexandre.torgue, netdev

Since dwmac-sti is a DT only driver checking for OF node is not necessary.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c
index 58c05ac..075ed42 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c
@@ -270,9 +270,6 @@ static int sti_dwmac_parse_data(struct sti_dwmac *dwmac,
 	struct regmap *regmap;
 	int err;
 
-	if (!np)
-		return -EINVAL;
-
 	/* clk selection from extra syscfg register */
 	dwmac->clk_sel_reg = -ENXIO;
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sti-clkconf");
-- 
2.10.1

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

* [net-next PATCH 2/7] stmmac: dwmac-sti: remove clk NULL checks
  2016-10-30 20:05 [net-next PATCH 0/7] stmmac: dwmac-sti refactor+cleanup Joachim Eastwood
  2016-10-30 20:05 ` [net-next PATCH 1/7] stmmac: dwmac-sti: remove useless of_node check Joachim Eastwood
@ 2016-10-30 20:05 ` Joachim Eastwood
  2016-10-30 20:05 ` [net-next PATCH 3/7] stmmac: dwmac-sti: add PM ops and resume function Joachim Eastwood
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Joachim Eastwood @ 2016-10-30 20:05 UTC (permalink / raw)
  To: davem; +Cc: Joachim Eastwood, peppe.cavallaro, alexandre.torgue, netdev

Since sti_dwmac_parse_data() sets dwmac->clk to NULL if not clock was
provided in DT and NULL is a valid clock there is no need to check for
NULL before using this clock.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c
index 075ed42..f009bf4 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c
@@ -191,7 +191,7 @@ static void stih4xx_fix_retime_src(void *priv, u32 spd)
 		}
 	}
 
-	if (src == TX_RETIME_SRC_CLKGEN && dwmac->clk && freq)
+	if (src == TX_RETIME_SRC_CLKGEN && freq)
 		clk_set_rate(dwmac->clk, freq);
 
 	regmap_update_bits(dwmac->regmap, reg, STIH4XX_RETIME_SRC_MASK,
@@ -222,7 +222,7 @@ static void stid127_fix_retime_src(void *priv, u32 spd)
 			freq = DWMAC_2_5MHZ;
 	}
 
-	if (dwmac->clk && freq)
+	if (freq)
 		clk_set_rate(dwmac->clk, freq);
 
 	regmap_update_bits(dwmac->regmap, reg, STID127_RETIME_SRC_MASK, val);
@@ -238,8 +238,7 @@ static int sti_dwmac_init(struct platform_device *pdev, void *priv)
 	u32 reg = dwmac->ctrl_reg;
 	u32 val;
 
-	if (dwmac->clk)
-		clk_prepare_enable(dwmac->clk);
+	clk_prepare_enable(dwmac->clk);
 
 	if (of_property_read_bool(np, "st,gmac_en"))
 		regmap_update_bits(regmap, reg, EN_MASK, EN);
@@ -258,8 +257,7 @@ static void sti_dwmac_exit(struct platform_device *pdev, void *priv)
 {
 	struct sti_dwmac *dwmac = priv;
 
-	if (dwmac->clk)
-		clk_disable_unprepare(dwmac->clk);
+	clk_disable_unprepare(dwmac->clk);
 }
 static int sti_dwmac_parse_data(struct sti_dwmac *dwmac,
 				struct platform_device *pdev)
-- 
2.10.1

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

* [net-next PATCH 3/7] stmmac: dwmac-sti: add PM ops and resume function
  2016-10-30 20:05 [net-next PATCH 0/7] stmmac: dwmac-sti refactor+cleanup Joachim Eastwood
  2016-10-30 20:05 ` [net-next PATCH 1/7] stmmac: dwmac-sti: remove useless of_node check Joachim Eastwood
  2016-10-30 20:05 ` [net-next PATCH 2/7] stmmac: dwmac-sti: remove clk NULL checks Joachim Eastwood
@ 2016-10-30 20:05 ` Joachim Eastwood
  2016-11-01 17:19   ` Joachim Eastwood
  2016-10-30 20:05 ` [net-next PATCH 4/7] stmmac: dwmac-sti: move st,gmac_en parsing to sti_dwmac_parse_data Joachim Eastwood
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 15+ messages in thread
From: Joachim Eastwood @ 2016-10-30 20:05 UTC (permalink / raw)
  To: davem; +Cc: Joachim Eastwood, peppe.cavallaro, alexandre.torgue, netdev

Implement PM callbacks and driver remove in the driver instead
of relying on the init/exit hooks in stmmac_platform. This gives
the driver more flexibility in how the code is organized.

Eventually the init/exit callbacks will be deprecated in favor
of the standard PM callbacks and driver remove function.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c | 46 +++++++++++++++++++------
 1 file changed, 36 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c
index f009bf4..09dd2be 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c
@@ -253,12 +253,6 @@ static int sti_dwmac_init(struct platform_device *pdev, void *priv)
 	return 0;
 }
 
-static void sti_dwmac_exit(struct platform_device *pdev, void *priv)
-{
-	struct sti_dwmac *dwmac = priv;
-
-	clk_disable_unprepare(dwmac->clk);
-}
 static int sti_dwmac_parse_data(struct sti_dwmac *dwmac,
 				struct platform_device *pdev)
 {
@@ -352,8 +346,6 @@ static int sti_dwmac_probe(struct platform_device *pdev)
 	dwmac->fix_retime_src = data->fix_retime_src;
 
 	plat_dat->bsp_priv = dwmac;
-	plat_dat->init = sti_dwmac_init;
-	plat_dat->exit = sti_dwmac_exit;
 	plat_dat->fix_mac_speed = data->fix_retime_src;
 
 	ret = sti_dwmac_init(pdev, plat_dat->bsp_priv);
@@ -363,6 +355,40 @@ static int sti_dwmac_probe(struct platform_device *pdev)
 	return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
 }
 
+static int sti_dwmac_remove(struct platform_device *pdev)
+{
+	struct sti_dwmac *dwmac = get_stmmac_bsp_priv(&pdev->dev);
+	int ret = stmmac_dvr_remove(&pdev->dev);
+
+	clk_disable_unprepare(dwmac->clk);
+
+	return ret;
+}
+
+#ifdef CONFIG_PM_SLEEP
+static int sti_dwmac_suspend(struct device *dev)
+{
+	struct sti_dwmac *dwmac = get_stmmac_bsp_priv(dev);
+	int ret = stmmac_suspend(dev);
+
+	clk_disable_unprepare(dwmac->clk);
+
+	return ret;
+}
+
+static int sti_dwmac_resume(struct device *dev)
+{
+	struct sti_dwmac *dwmac = get_stmmac_bsp_priv(dev);
+	struct platform_device *pdev = to_platform_device(dev);
+
+	sti_dwmac_init(pdev, dwmac);
+
+	return stmmac_resume(dev);
+}
+#endif /* CONFIG_PM_SLEEP */
+
+SIMPLE_DEV_PM_OPS(sti_dwmac_pm_ops, sti_dwmac_suspend, sti_dwmac_resume);
+
 static const struct sti_dwmac_of_data stih4xx_dwmac_data = {
 	.fix_retime_src = stih4xx_fix_retime_src,
 };
@@ -382,10 +408,10 @@ MODULE_DEVICE_TABLE(of, sti_dwmac_match);
 
 static struct platform_driver sti_dwmac_driver = {
 	.probe  = sti_dwmac_probe,
-	.remove = stmmac_pltfr_remove,
+	.remove = sti_dwmac_remove,
 	.driver = {
 		.name           = "sti-dwmac",
-		.pm		= &stmmac_pltfr_pm_ops,
+		.pm		= &sti_dwmac_pm_ops,
 		.of_match_table = sti_dwmac_match,
 	},
 };
-- 
2.10.1

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

* [net-next PATCH 4/7] stmmac: dwmac-sti: move st,gmac_en parsing to sti_dwmac_parse_data
  2016-10-30 20:05 [net-next PATCH 0/7] stmmac: dwmac-sti refactor+cleanup Joachim Eastwood
                   ` (2 preceding siblings ...)
  2016-10-30 20:05 ` [net-next PATCH 3/7] stmmac: dwmac-sti: add PM ops and resume function Joachim Eastwood
@ 2016-10-30 20:05 ` Joachim Eastwood
  2016-10-30 20:05 ` [net-next PATCH 5/7] stmmac: dwmac-sti: move clk_prepare_enable out of init and add error handling Joachim Eastwood
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Joachim Eastwood @ 2016-10-30 20:05 UTC (permalink / raw)
  To: davem; +Cc: Joachim Eastwood, peppe.cavallaro, alexandre.torgue, netdev

The sti_dwmac_init() function is called both from probe and resume.
Since DT properties doesn't change between suspend/resume cycles move
parsing of this parameter into sti_dwmac_parse_data() where it belongs.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c
index 09dd2be..e814b68 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c
@@ -128,6 +128,7 @@ struct sti_dwmac {
 	int clk_sel_reg;	/* GMAC ext clk selection register */
 	struct device *dev;
 	struct regmap *regmap;
+	bool gmac_en;
 	u32 speed;
 	void (*fix_retime_src)(void *priv, unsigned int speed);
 };
@@ -233,14 +234,12 @@ 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;
-	struct device_node *np = dev->of_node;
 	u32 reg = dwmac->ctrl_reg;
 	u32 val;
 
 	clk_prepare_enable(dwmac->clk);
 
-	if (of_property_read_bool(np, "st,gmac_en"))
+	if (dwmac->gmac_en)
 		regmap_update_bits(regmap, reg, EN_MASK, EN);
 
 	regmap_update_bits(regmap, reg, MII_PHY_SEL_MASK, phy_intf_sels[iface]);
@@ -281,6 +280,7 @@ static int sti_dwmac_parse_data(struct sti_dwmac *dwmac,
 	dwmac->dev = dev;
 	dwmac->interface = of_get_phy_mode(np);
 	dwmac->regmap = regmap;
+	dwmac->gmac_en = of_property_read_bool(np, "st,gmac_en");
 	dwmac->ext_phyclk = of_property_read_bool(np, "st,ext-phyclk");
 	dwmac->tx_retime_src = TX_RETIME_SRC_NA;
 	dwmac->speed = SPEED_100;
-- 
2.10.1

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

* [net-next PATCH 5/7] stmmac: dwmac-sti: move clk_prepare_enable out of init and add error handling
  2016-10-30 20:05 [net-next PATCH 0/7] stmmac: dwmac-sti refactor+cleanup Joachim Eastwood
                   ` (3 preceding siblings ...)
  2016-10-30 20:05 ` [net-next PATCH 4/7] stmmac: dwmac-sti: move st,gmac_en parsing to sti_dwmac_parse_data Joachim Eastwood
@ 2016-10-30 20:05 ` Joachim Eastwood
  2016-10-30 20:05 ` [net-next PATCH 6/7] stmmac: dwmac-sti: clean up and rename sti_dwmac_init Joachim Eastwood
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Joachim Eastwood @ 2016-10-30 20:05 UTC (permalink / raw)
  To: davem; +Cc: Joachim Eastwood, peppe.cavallaro, alexandre.torgue, netdev

Add clock error handling to probe and in the process move clock enabling
out of sti_dwmac_init() to make this easier.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c
index e814b68..aa75a27 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c
@@ -237,8 +237,6 @@ static int sti_dwmac_init(struct platform_device *pdev, void *priv)
 	u32 reg = dwmac->ctrl_reg;
 	u32 val;
 
-	clk_prepare_enable(dwmac->clk);
-
 	if (dwmac->gmac_en)
 		regmap_update_bits(regmap, reg, EN_MASK, EN);
 
@@ -348,11 +346,23 @@ static int sti_dwmac_probe(struct platform_device *pdev)
 	plat_dat->bsp_priv = dwmac;
 	plat_dat->fix_mac_speed = data->fix_retime_src;
 
-	ret = sti_dwmac_init(pdev, plat_dat->bsp_priv);
+	ret = clk_prepare_enable(dwmac->clk);
 	if (ret)
 		return ret;
 
-	return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
+	ret = sti_dwmac_init(pdev, plat_dat->bsp_priv);
+	if (ret)
+		goto disable_clk;
+
+	ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
+	if (ret)
+		goto disable_clk;
+
+	return 0;
+
+disable_clk:
+	clk_disable_unprepare(dwmac->clk);
+	return ret;
 }
 
 static int sti_dwmac_remove(struct platform_device *pdev)
@@ -381,6 +391,7 @@ static int sti_dwmac_resume(struct device *dev)
 	struct sti_dwmac *dwmac = get_stmmac_bsp_priv(dev);
 	struct platform_device *pdev = to_platform_device(dev);
 
+	clk_prepare_enable(dwmac->clk);
 	sti_dwmac_init(pdev, dwmac);
 
 	return stmmac_resume(dev);
-- 
2.10.1

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

* [net-next PATCH 6/7] stmmac: dwmac-sti: clean up and rename sti_dwmac_init
  2016-10-30 20:05 [net-next PATCH 0/7] stmmac: dwmac-sti refactor+cleanup Joachim Eastwood
                   ` (4 preceding siblings ...)
  2016-10-30 20:05 ` [net-next PATCH 5/7] stmmac: dwmac-sti: move clk_prepare_enable out of init and add error handling Joachim Eastwood
@ 2016-10-30 20:05 ` Joachim Eastwood
  2016-10-30 20:05 ` [net-next PATCH 7/7] stmmac: dwmac-sti: remove unused priv dev member Joachim Eastwood
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Joachim Eastwood @ 2016-10-30 20:05 UTC (permalink / raw)
  To: davem; +Cc: Joachim Eastwood, peppe.cavallaro, alexandre.torgue, netdev

Rename sti_dwmac_init to sti_dwmac_set_phy_mode which is a better
description for what it really does.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c
index aa75a27..0af3faa 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c
@@ -229,9 +229,8 @@ static void stid127_fix_retime_src(void *priv, u32 spd)
 	regmap_update_bits(dwmac->regmap, reg, STID127_RETIME_SRC_MASK, val);
 }
 
-static int sti_dwmac_init(struct platform_device *pdev, void *priv)
+static int sti_dwmac_set_phy_mode(struct sti_dwmac *dwmac)
 {
-	struct sti_dwmac *dwmac = priv;
 	struct regmap *regmap = dwmac->regmap;
 	int iface = dwmac->interface;
 	u32 reg = dwmac->ctrl_reg;
@@ -245,7 +244,7 @@ static int sti_dwmac_init(struct platform_device *pdev, void *priv)
 	val = (iface == PHY_INTERFACE_MODE_REVMII) ? 0 : ENMII;
 	regmap_update_bits(regmap, reg, ENMII_MASK, val);
 
-	dwmac->fix_retime_src(priv, dwmac->speed);
+	dwmac->fix_retime_src(dwmac, dwmac->speed);
 
 	return 0;
 }
@@ -350,7 +349,7 @@ static int sti_dwmac_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	ret = sti_dwmac_init(pdev, plat_dat->bsp_priv);
+	ret = sti_dwmac_set_phy_mode(dwmac);
 	if (ret)
 		goto disable_clk;
 
@@ -389,10 +388,9 @@ static int sti_dwmac_suspend(struct device *dev)
 static int sti_dwmac_resume(struct device *dev)
 {
 	struct sti_dwmac *dwmac = get_stmmac_bsp_priv(dev);
-	struct platform_device *pdev = to_platform_device(dev);
 
 	clk_prepare_enable(dwmac->clk);
-	sti_dwmac_init(pdev, dwmac);
+	sti_dwmac_set_phy_mode(dwmac);
 
 	return stmmac_resume(dev);
 }
-- 
2.10.1

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

* [net-next PATCH 7/7] stmmac: dwmac-sti: remove unused priv dev member
  2016-10-30 20:05 [net-next PATCH 0/7] stmmac: dwmac-sti refactor+cleanup Joachim Eastwood
                   ` (5 preceding siblings ...)
  2016-10-30 20:05 ` [net-next PATCH 6/7] stmmac: dwmac-sti: clean up and rename sti_dwmac_init Joachim Eastwood
@ 2016-10-30 20:05 ` Joachim Eastwood
  2016-10-31 19:47 ` [net-next PATCH 0/7] stmmac: dwmac-sti refactor+cleanup David Miller
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Joachim Eastwood @ 2016-10-30 20:05 UTC (permalink / raw)
  To: davem; +Cc: Joachim Eastwood, peppe.cavallaro, alexandre.torgue, netdev

The dev member of struct sti_dwmac is not used anywhere in the driver
so lets just remove it.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c
index 0af3faa..f51fb16 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c
@@ -126,7 +126,6 @@ struct sti_dwmac {
 	struct clk *clk;	/* PHY clock */
 	u32 ctrl_reg;		/* GMAC glue-logic control register */
 	int clk_sel_reg;	/* GMAC ext clk selection register */
-	struct device *dev;
 	struct regmap *regmap;
 	bool gmac_en;
 	u32 speed;
@@ -274,7 +273,6 @@ static int sti_dwmac_parse_data(struct sti_dwmac *dwmac,
 		return err;
 	}
 
-	dwmac->dev = dev;
 	dwmac->interface = of_get_phy_mode(np);
 	dwmac->regmap = regmap;
 	dwmac->gmac_en = of_property_read_bool(np, "st,gmac_en");
-- 
2.10.1

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

* Re: [net-next PATCH 0/7] stmmac: dwmac-sti refactor+cleanup
  2016-10-30 20:05 [net-next PATCH 0/7] stmmac: dwmac-sti refactor+cleanup Joachim Eastwood
                   ` (6 preceding siblings ...)
  2016-10-30 20:05 ` [net-next PATCH 7/7] stmmac: dwmac-sti: remove unused priv dev member Joachim Eastwood
@ 2016-10-31 19:47 ` David Miller
  2016-11-01 15:56   ` David Miller
  2016-11-02  6:39 ` Giuseppe CAVALLARO
  2016-11-04 13:49 ` Giuseppe CAVALLARO
  9 siblings, 1 reply; 15+ messages in thread
From: David Miller @ 2016-10-31 19:47 UTC (permalink / raw)
  To: manabian; +Cc: peppe.cavallaro, alexandre.torgue, netdev

From: Joachim Eastwood <manabian@gmail.com>
Date: Sun, 30 Oct 2016 21:05:00 +0100

> This patch set aims to remove the init/exit callbacks from the 
> dwmac-sti driver and instead use standard PM callbacks. Doing this
> will also allow us to cleanup the driver.
> 
> Eventually the init/exit callbacks will be deprecated and removed
> from all drivers dwmac-* except for dwmac-generic. Drivers will be
> refactored to use standard PM and remove callbacks.
> 
> Note that this patch set has only been test compiled and no functional
> change is intended.

I would really like to see some review and testing before applying this
series.

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

* Re: [net-next PATCH 0/7] stmmac: dwmac-sti refactor+cleanup
  2016-10-31 19:47 ` [net-next PATCH 0/7] stmmac: dwmac-sti refactor+cleanup David Miller
@ 2016-11-01 15:56   ` David Miller
  2016-11-01 17:00     ` Joachim Eastwood
  0 siblings, 1 reply; 15+ messages in thread
From: David Miller @ 2016-11-01 15:56 UTC (permalink / raw)
  To: manabian; +Cc: peppe.cavallaro, alexandre.torgue, netdev

From: David Miller <davem@davemloft.net>
Date: Mon, 31 Oct 2016 15:47:26 -0400 (EDT)

> From: Joachim Eastwood <manabian@gmail.com>
> Date: Sun, 30 Oct 2016 21:05:00 +0100
> 
>> This patch set aims to remove the init/exit callbacks from the 
>> dwmac-sti driver and instead use standard PM callbacks. Doing this
>> will also allow us to cleanup the driver.
>> 
>> Eventually the init/exit callbacks will be deprecated and removed
>> from all drivers dwmac-* except for dwmac-generic. Drivers will be
>> refactored to use standard PM and remove callbacks.
>> 
>> Note that this patch set has only been test compiled and no functional
>> change is intended.
> 
> I would really like to see some review and testing before applying this
> series.

Ping?

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

* Re: [net-next PATCH 0/7] stmmac: dwmac-sti refactor+cleanup
  2016-11-01 15:56   ` David Miller
@ 2016-11-01 17:00     ` Joachim Eastwood
  0 siblings, 0 replies; 15+ messages in thread
From: Joachim Eastwood @ 2016-11-01 17:00 UTC (permalink / raw)
  To: David Miller, Patrice Chotard
  Cc: peppe.cavallaro, alexandre.torgue, netdev, kernel

Hi,

On 1 November 2016 at 16:56, David Miller <davem@davemloft.net> wrote:
> From: David Miller <davem@davemloft.net>
> Date: Mon, 31 Oct 2016 15:47:26 -0400 (EDT)
>
>> From: Joachim Eastwood <manabian@gmail.com>
>> Date: Sun, 30 Oct 2016 21:05:00 +0100
>>
>>> This patch set aims to remove the init/exit callbacks from the
>>> dwmac-sti driver and instead use standard PM callbacks. Doing this
>>> will also allow us to cleanup the driver.
>>>
>>> Eventually the init/exit callbacks will be deprecated and removed
>>> from all drivers dwmac-* except for dwmac-generic. Drivers will be
>>> refactored to use standard PM and remove callbacks.
>>>
>>> Note that this patch set has only been test compiled and no functional
>>> change is intended.
>>
>> I would really like to see some review and testing before applying this
>> series.
>
> Ping?

Adding some more ST people.

Could anyone with a stih407 platform please give these patches a try?

The series can found at https://github.com/manabian/linux-lpc.git in
the net-sti-dwmac branch (based on net-next).
Alternatively they can also be picked from netdev's patchwork.


regards,
Joachim Eastwood

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

* Re: [net-next PATCH 3/7] stmmac: dwmac-sti: add PM ops and resume function
  2016-10-30 20:05 ` [net-next PATCH 3/7] stmmac: dwmac-sti: add PM ops and resume function Joachim Eastwood
@ 2016-11-01 17:19   ` Joachim Eastwood
  0 siblings, 0 replies; 15+ messages in thread
From: Joachim Eastwood @ 2016-11-01 17:19 UTC (permalink / raw)
  To: David S. Miller
  Cc: Joachim Eastwood, peppe.cavallaro, alexandre.torgue, netdev

On 30 October 2016 at 21:05, Joachim Eastwood <manabian@gmail.com> wrote:
> Implement PM callbacks and driver remove in the driver instead
> of relying on the init/exit hooks in stmmac_platform. This gives
> the driver more flexibility in how the code is organized.
>
> Eventually the init/exit callbacks will be deprecated in favor
> of the standard PM callbacks and driver remove function.
>
> Signed-off-by: Joachim Eastwood <manabian@gmail.com>
> ---
>  drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c | 46 +++++++++++++++++++------
>  1 file changed, 36 insertions(+), 10 deletions(-)
> +#ifdef CONFIG_PM_SLEEP
> +static int sti_dwmac_suspend(struct device *dev)
> +{
> +       struct sti_dwmac *dwmac = get_stmmac_bsp_priv(dev);
> +       int ret = stmmac_suspend(dev);
> +
> +       clk_disable_unprepare(dwmac->clk);
> +
> +       return ret;
> +}
> +
> +static int sti_dwmac_resume(struct device *dev)
> +{
> +       struct sti_dwmac *dwmac = get_stmmac_bsp_priv(dev);
> +       struct platform_device *pdev = to_platform_device(dev);
> +
> +       sti_dwmac_init(pdev, dwmac);
> +
> +       return stmmac_resume(dev);
> +}
> +#endif /* CONFIG_PM_SLEEP */
> +
> +SIMPLE_DEV_PM_OPS(sti_dwmac_pm_ops, sti_dwmac_suspend, sti_dwmac_resume);

Just noticed that I am missing a 'static' here.

As this not critical for testing I'll resend the patch set after I
(hopefully) get some response from someone with the hw that can do a
test.


regards,
Joachim Eastwood

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

* Re: [net-next PATCH 0/7] stmmac: dwmac-sti refactor+cleanup
  2016-10-30 20:05 [net-next PATCH 0/7] stmmac: dwmac-sti refactor+cleanup Joachim Eastwood
                   ` (7 preceding siblings ...)
  2016-10-31 19:47 ` [net-next PATCH 0/7] stmmac: dwmac-sti refactor+cleanup David Miller
@ 2016-11-02  6:39 ` Giuseppe CAVALLARO
  2016-11-04 13:49 ` Giuseppe CAVALLARO
  9 siblings, 0 replies; 15+ messages in thread
From: Giuseppe CAVALLARO @ 2016-11-02  6:39 UTC (permalink / raw)
  To: Joachim Eastwood, davem; +Cc: alexandre.torgue, netdev

Hello Joachim

thx for this series, I will review them and test the changes
on my board asap ... I let you known.

Peppe

On 10/30/2016 9:05 PM, Joachim Eastwood wrote:
> This patch set aims to remove the init/exit callbacks from the
> dwmac-sti driver and instead use standard PM callbacks. Doing this
> will also allow us to cleanup the driver.
>
> Eventually the init/exit callbacks will be deprecated and removed
> from all drivers dwmac-* except for dwmac-generic. Drivers will be
> refactored to use standard PM and remove callbacks.
>
> Note that this patch set has only been test compiled and no functional
> change is intended.
>
> Joachim Eastwood (7):
>   stmmac: dwmac-sti: remove useless of_node check
>   stmmac: dwmac-sti: remove clk NULL checks
>   stmmac: dwmac-sti: add PM ops and resume function
>   stmmac: dwmac-sti: move st,gmac_en parsing to sti_dwmac_parse_data
>   stmmac: dwmac-sti: move clk_prepare_enable out of init and add error handling
>   stmmac: dwmac-sti: clean up and rename sti_dwmac_init
>   stmmac: dwmac-sti: remove unused priv dev member
>
>  drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c | 86 ++++++++++++++++---------
>  1 file changed, 57 insertions(+), 29 deletions(-)
>

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

* Re: [net-next PATCH 0/7] stmmac: dwmac-sti refactor+cleanup
  2016-10-30 20:05 [net-next PATCH 0/7] stmmac: dwmac-sti refactor+cleanup Joachim Eastwood
                   ` (8 preceding siblings ...)
  2016-11-02  6:39 ` Giuseppe CAVALLARO
@ 2016-11-04 13:49 ` Giuseppe CAVALLARO
  2016-11-04 16:19   ` Joachim Eastwood
  9 siblings, 1 reply; 15+ messages in thread
From: Giuseppe CAVALLARO @ 2016-11-04 13:49 UTC (permalink / raw)
  To: Joachim Eastwood, davem; +Cc: alexandre.torgue, netdev

Hello Joachim.

I have tested the patches on STiH390 with GMAC4 and the driver is ok.

So you can add my Acked-by/Tested-by in the V2.

I just ask you, when rename the sti_dwmac_init in sti_dwmac_set_phy_mode
to use another name: sti_dwmac_set_mode could be good, IMO.

In fact, this function is not strictly related to the PHY and the
system config registers could touch different MAC/MII settings.

Regards
Peppe

On 10/30/2016 9:05 PM, Joachim Eastwood wrote:
> This patch set aims to remove the init/exit callbacks from the
> dwmac-sti driver and instead use standard PM callbacks. Doing this
> will also allow us to cleanup the driver.
>
> Eventually the init/exit callbacks will be deprecated and removed
> from all drivers dwmac-* except for dwmac-generic. Drivers will be
> refactored to use standard PM and remove callbacks.
>
> Note that this patch set has only been test compiled and no functional
> change is intended.
>
> Joachim Eastwood (7):
>   stmmac: dwmac-sti: remove useless of_node check
>   stmmac: dwmac-sti: remove clk NULL checks
>   stmmac: dwmac-sti: add PM ops and resume function
>   stmmac: dwmac-sti: move st,gmac_en parsing to sti_dwmac_parse_data
>   stmmac: dwmac-sti: move clk_prepare_enable out of init and add error handling
>   stmmac: dwmac-sti: clean up and rename sti_dwmac_init
>   stmmac: dwmac-sti: remove unused priv dev member
>
>  drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c | 86 ++++++++++++++++---------
>  1 file changed, 57 insertions(+), 29 deletions(-)
>

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

* Re: [net-next PATCH 0/7] stmmac: dwmac-sti refactor+cleanup
  2016-11-04 13:49 ` Giuseppe CAVALLARO
@ 2016-11-04 16:19   ` Joachim Eastwood
  0 siblings, 0 replies; 15+ messages in thread
From: Joachim Eastwood @ 2016-11-04 16:19 UTC (permalink / raw)
  To: Giuseppe CAVALLARO; +Cc: David S. Miller, alexandre.torgue, netdev

Hi Giuseppe,

On 4 November 2016 at 14:49, Giuseppe CAVALLARO <peppe.cavallaro@st.com> wrote:
> Hello Joachim.
>
> I have tested the patches on STiH390 with GMAC4 and the driver is ok.
>
> So you can add my Acked-by/Tested-by in the V2.

Thanks! I'll send a V2 later today or tomorrow.


> I just ask you, when rename the sti_dwmac_init in sti_dwmac_set_phy_mode
> to use another name: sti_dwmac_set_mode could be good, IMO.

Sure thing.


regards,
Joachim Eastwood

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

end of thread, other threads:[~2016-11-04 16:19 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-30 20:05 [net-next PATCH 0/7] stmmac: dwmac-sti refactor+cleanup Joachim Eastwood
2016-10-30 20:05 ` [net-next PATCH 1/7] stmmac: dwmac-sti: remove useless of_node check Joachim Eastwood
2016-10-30 20:05 ` [net-next PATCH 2/7] stmmac: dwmac-sti: remove clk NULL checks Joachim Eastwood
2016-10-30 20:05 ` [net-next PATCH 3/7] stmmac: dwmac-sti: add PM ops and resume function Joachim Eastwood
2016-11-01 17:19   ` Joachim Eastwood
2016-10-30 20:05 ` [net-next PATCH 4/7] stmmac: dwmac-sti: move st,gmac_en parsing to sti_dwmac_parse_data Joachim Eastwood
2016-10-30 20:05 ` [net-next PATCH 5/7] stmmac: dwmac-sti: move clk_prepare_enable out of init and add error handling Joachim Eastwood
2016-10-30 20:05 ` [net-next PATCH 6/7] stmmac: dwmac-sti: clean up and rename sti_dwmac_init Joachim Eastwood
2016-10-30 20:05 ` [net-next PATCH 7/7] stmmac: dwmac-sti: remove unused priv dev member Joachim Eastwood
2016-10-31 19:47 ` [net-next PATCH 0/7] stmmac: dwmac-sti refactor+cleanup David Miller
2016-11-01 15:56   ` David Miller
2016-11-01 17:00     ` Joachim Eastwood
2016-11-02  6:39 ` Giuseppe CAVALLARO
2016-11-04 13:49 ` Giuseppe CAVALLARO
2016-11-04 16:19   ` Joachim Eastwood

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.