* [PATCH net-next 0/5] stmmac: dwmac-socfpga refactor+cleanup
@ 2016-04-26 21:24 Joachim Eastwood
2016-04-26 21:24 ` [PATCH net-next 1/5] stmmac: let remove/resume/suspend functions take device pointer Joachim Eastwood
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Joachim Eastwood @ 2016-04-26 21:24 UTC (permalink / raw)
To: davem
Cc: Joachim Eastwood, marex, dinguyen, peppe.cavallaro,
alexandre.torgue, netdev
This patch aims to remove the init/exit callbacks from the dwmac-
socfpga 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.
This patch set should not change the behavior of the driver itself,
it only moves code around. The only exception to this is patch
number 4 which restores the resume callback behavior which was
changed in the "net: stmmac: socfpga: Remove re-registration of
reset controller" patch. I belive calling phy_resume() only
from the resume callback and not probe is the right thing to do.
Couple of heads-up here:
1. This patch set depend on Marek's "Remove re-registration of
reset controller" patch [1] which is not in net-next yet.
Without that patch this set will not apply!
2. The first patch changes the prototype of a couple of
functions used in Alexandre's "add Ethernet glue logic for
stm32 chip" patch [2] and will cause build failures for
dwmac-stm32.c if not fixed up!
If Alexandre's patch set is applied first I will gladly
rebase my patch set to account for his driver as well.
So at the moment there are issues here :/
I guess one way of handing this would just be wait for all
the bits to come together in net-next and resend.
Dave: Please let me know if you have any preferred way of
handling this.
[1] https://patchwork.ozlabs.org/patch/613085/
[2] https://patchwork.ozlabs.org/patch/614405/
Joachim Eastwood (5):
stmmac: let remove/resume/suspend functions take device pointer
stmmac: dwmac-socfpga: add PM ops and resume function
stmmac: dwmac-socfpga: keep a copy of stmmac_rst in driver priv data
stmmac: dwmac-socfpga: call phy_resume() only in resume callback
stmmac: dwmac-socfpga: kill init() and rename setup() to set_phy_mode()
.../net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 106 +++++++++++----------
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 6 +-
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 15 +--
drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | 24 +----
.../net/ethernet/stmicro/stmmac/stmmac_platform.c | 6 +-
5 files changed, 71 insertions(+), 86 deletions(-)
--
2.8.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH net-next 1/5] stmmac: let remove/resume/suspend functions take device pointer
2016-04-26 21:24 [PATCH net-next 0/5] stmmac: dwmac-socfpga refactor+cleanup Joachim Eastwood
@ 2016-04-26 21:24 ` Joachim Eastwood
2016-04-26 21:24 ` [PATCH net-next 2/5] stmmac: dwmac-socfpga: add PM ops and resume function Joachim Eastwood
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Joachim Eastwood @ 2016-04-26 21:24 UTC (permalink / raw)
To: davem
Cc: Joachim Eastwood, marex, dinguyen, peppe.cavallaro,
alexandre.torgue, netdev
Change stmmac_remove/resume/suspend to take a device pointer so
they can be used directly by drivers that doesn't need to perform
anything device specific.
This lets us remove the PCI pm functions and later simplifiy the
platform drivers.
Signed-off-by: Joachim Eastwood <manabian@gmail.com>
Tested-by: Marek Vasut <marex@denx.de>
---
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 6 +++---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 15 ++++++++------
drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | 24 ++--------------------
.../net/ethernet/stmicro/stmmac/stmmac_platform.c | 6 +++---
4 files changed, 17 insertions(+), 34 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index ff67506..59ae608 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -148,9 +148,9 @@ void stmmac_set_ethtool_ops(struct net_device *netdev);
int stmmac_ptp_register(struct stmmac_priv *priv);
void stmmac_ptp_unregister(struct stmmac_priv *priv);
-int stmmac_resume(struct net_device *ndev);
-int stmmac_suspend(struct net_device *ndev);
-int stmmac_dvr_remove(struct net_device *ndev);
+int stmmac_resume(struct device *dev);
+int stmmac_suspend(struct device *dev);
+int stmmac_dvr_remove(struct device *dev);
int stmmac_dvr_probe(struct device *device,
struct plat_stmmacenet_data *plat_dat,
struct stmmac_resources *res);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index b87edb7..fd5ab7b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -3350,12 +3350,13 @@ EXPORT_SYMBOL_GPL(stmmac_dvr_probe);
/**
* stmmac_dvr_remove
- * @ndev: net device pointer
+ * @dev: device pointer
* Description: this function resets the TX/RX processes, disables the MAC RX/TX
* changes the link status, releases the DMA descriptor rings.
*/
-int stmmac_dvr_remove(struct net_device *ndev)
+int stmmac_dvr_remove(struct device *dev)
{
+ struct net_device *ndev = dev_get_drvdata(dev);
struct stmmac_priv *priv = netdev_priv(ndev);
pr_info("%s:\n\tremoving driver", __func__);
@@ -3381,13 +3382,14 @@ EXPORT_SYMBOL_GPL(stmmac_dvr_remove);
/**
* stmmac_suspend - suspend callback
- * @ndev: net device pointer
+ * @dev: device pointer
* Description: this is the function to suspend the device and it is called
* by the platform driver to stop the network queue, release the resources,
* program the PMT register (for WoL), clean and release driver resources.
*/
-int stmmac_suspend(struct net_device *ndev)
+int stmmac_suspend(struct device *dev)
{
+ struct net_device *ndev = dev_get_drvdata(dev);
struct stmmac_priv *priv = netdev_priv(ndev);
unsigned long flags;
@@ -3430,12 +3432,13 @@ EXPORT_SYMBOL_GPL(stmmac_suspend);
/**
* stmmac_resume - resume callback
- * @ndev: net device pointer
+ * @dev: device pointer
* Description: when resume this function is invoked to setup the DMA and CORE
* in a usable state.
*/
-int stmmac_resume(struct net_device *ndev)
+int stmmac_resume(struct device *dev)
{
+ struct net_device *ndev = dev_get_drvdata(dev);
struct stmmac_priv *priv = netdev_priv(ndev);
unsigned long flags;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
index ae43887..56c8a23 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
@@ -231,30 +231,10 @@ static int stmmac_pci_probe(struct pci_dev *pdev,
*/
static void stmmac_pci_remove(struct pci_dev *pdev)
{
- struct net_device *ndev = pci_get_drvdata(pdev);
-
- stmmac_dvr_remove(ndev);
-}
-
-#ifdef CONFIG_PM_SLEEP
-static int stmmac_pci_suspend(struct device *dev)
-{
- struct pci_dev *pdev = to_pci_dev(dev);
- struct net_device *ndev = pci_get_drvdata(pdev);
-
- return stmmac_suspend(ndev);
-}
-
-static int stmmac_pci_resume(struct device *dev)
-{
- struct pci_dev *pdev = to_pci_dev(dev);
- struct net_device *ndev = pci_get_drvdata(pdev);
-
- return stmmac_resume(ndev);
+ stmmac_dvr_remove(&pdev->dev);
}
-#endif
-static SIMPLE_DEV_PM_OPS(stmmac_pm_ops, stmmac_pci_suspend, stmmac_pci_resume);
+static SIMPLE_DEV_PM_OPS(stmmac_pm_ops, stmmac_suspend, stmmac_resume);
#define STMMAC_VENDOR_ID 0x700
#define STMMAC_QUARK_ID 0x0937
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index effaa4f..409db91 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -386,7 +386,7 @@ int stmmac_pltfr_remove(struct platform_device *pdev)
{
struct net_device *ndev = platform_get_drvdata(pdev);
struct stmmac_priv *priv = netdev_priv(ndev);
- int ret = stmmac_dvr_remove(ndev);
+ int ret = stmmac_dvr_remove(&pdev->dev);
if (priv->plat->exit)
priv->plat->exit(pdev, priv->plat->bsp_priv);
@@ -410,7 +410,7 @@ static int stmmac_pltfr_suspend(struct device *dev)
struct stmmac_priv *priv = netdev_priv(ndev);
struct platform_device *pdev = to_platform_device(dev);
- ret = stmmac_suspend(ndev);
+ ret = stmmac_suspend(dev);
if (priv->plat->exit)
priv->plat->exit(pdev, priv->plat->bsp_priv);
@@ -433,7 +433,7 @@ static int stmmac_pltfr_resume(struct device *dev)
if (priv->plat->init)
priv->plat->init(pdev, priv->plat->bsp_priv);
- return stmmac_resume(ndev);
+ return stmmac_resume(dev);
}
#endif /* CONFIG_PM_SLEEP */
--
2.8.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net-next 2/5] stmmac: dwmac-socfpga: add PM ops and resume function
2016-04-26 21:24 [PATCH net-next 0/5] stmmac: dwmac-socfpga refactor+cleanup Joachim Eastwood
2016-04-26 21:24 ` [PATCH net-next 1/5] stmmac: let remove/resume/suspend functions take device pointer Joachim Eastwood
@ 2016-04-26 21:24 ` Joachim Eastwood
2016-04-26 21:24 ` [PATCH net-next 3/5] stmmac: dwmac-socfpga: keep a copy of stmmac_rst in driver priv data Joachim Eastwood
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Joachim Eastwood @ 2016-04-26 21:24 UTC (permalink / raw)
To: davem
Cc: Joachim Eastwood, marex, dinguyen, peppe.cavallaro,
alexandre.torgue, netdev
Implement the needed PM callbacks 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>
Tested-by: Marek Vasut <marex@denx.de>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
index 784eb53..789013a 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
@@ -261,7 +261,6 @@ static int socfpga_dwmac_probe(struct platform_device *pdev)
}
plat_dat->bsp_priv = dwmac;
- plat_dat->init = socfpga_dwmac_init;
plat_dat->fix_mac_speed = socfpga_dwmac_fix_mac_speed;
ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
@@ -271,6 +270,21 @@ static int socfpga_dwmac_probe(struct platform_device *pdev)
return ret;
}
+#ifdef CONFIG_PM_SLEEP
+static int socfpga_dwmac_resume(struct device *dev)
+{
+ struct platform_device *pdev = to_platform_device(dev);
+ struct net_device *ndev = dev_get_drvdata(dev);
+ struct stmmac_priv *priv = netdev_priv(ndev);
+
+ socfpga_dwmac_init(pdev, priv->plat->bsp_priv);
+
+ return stmmac_resume(dev);
+}
+#endif /* CONFIG_PM_SLEEP */
+
+SIMPLE_DEV_PM_OPS(socfpga_dwmac_pm_ops, stmmac_suspend, socfpga_dwmac_resume);
+
static const struct of_device_id socfpga_dwmac_match[] = {
{ .compatible = "altr,socfpga-stmmac" },
{ }
@@ -282,7 +296,7 @@ static struct platform_driver socfpga_dwmac_driver = {
.remove = stmmac_pltfr_remove,
.driver = {
.name = "socfpga-dwmac",
- .pm = &stmmac_pltfr_pm_ops,
+ .pm = &socfpga_dwmac_pm_ops,
.of_match_table = socfpga_dwmac_match,
},
};
--
2.8.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net-next 3/5] stmmac: dwmac-socfpga: keep a copy of stmmac_rst in driver priv data
2016-04-26 21:24 [PATCH net-next 0/5] stmmac: dwmac-socfpga refactor+cleanup Joachim Eastwood
2016-04-26 21:24 ` [PATCH net-next 1/5] stmmac: let remove/resume/suspend functions take device pointer Joachim Eastwood
2016-04-26 21:24 ` [PATCH net-next 2/5] stmmac: dwmac-socfpga: add PM ops and resume function Joachim Eastwood
@ 2016-04-26 21:24 ` Joachim Eastwood
2016-04-26 21:24 ` [PATCH net-next 4/5] stmmac: dwmac-socfpga: call phy_resume() only in resume callback Joachim Eastwood
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Joachim Eastwood @ 2016-04-26 21:24 UTC (permalink / raw)
To: davem
Cc: Joachim Eastwood, marex, dinguyen, peppe.cavallaro,
alexandre.torgue, netdev
The dwmac-socfpga driver needs to control the reset usually managed
by the core driver to set the PHY mode. Take a copy of the reset
handle from core priv data so it can be used by the driver later.
This also allow us to move reset handling into socfpga_dwmac_setup()
where the code that needs it is located.
Signed-off-by: Joachim Eastwood <manabian@gmail.com>
Tested-by: Marek Vasut <marex@denx.de>
---
.../net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 33 ++++++++++++++--------
1 file changed, 22 insertions(+), 11 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
index 789013a..ba0b793 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
@@ -49,6 +49,7 @@ struct socfpga_dwmac {
u32 reg_shift;
struct device *dev;
struct regmap *sys_mgr_base_addr;
+ struct reset_control *stmmac_rst;
void __iomem *splitter_base;
bool f2h_ptp_ref_clk;
};
@@ -164,6 +165,10 @@ static int socfpga_dwmac_setup(struct socfpga_dwmac *dwmac)
if (dwmac->splitter_base)
val = SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_GMII_MII;
+ /* Assert reset to the enet controller before changing the phy mode */
+ if (dwmac->stmmac_rst)
+ reset_control_assert(dwmac->stmmac_rst);
+
regmap_read(sys_mgr_base_addr, reg_offset, &ctrl);
ctrl &= ~(SYSMGR_EMACGRP_CTRL_PHYSEL_MASK << reg_shift);
ctrl |= val << reg_shift;
@@ -181,6 +186,12 @@ static int socfpga_dwmac_setup(struct socfpga_dwmac *dwmac)
regmap_write(sys_mgr_base_addr, reg_offset, ctrl);
+ /* Deassert reset for the phy configuration to be sampled by
+ * the enet controller, and operation to start in requested mode
+ */
+ if (dwmac->stmmac_rst)
+ reset_control_deassert(dwmac->stmmac_rst);
+
return 0;
}
@@ -198,21 +209,11 @@ static int socfpga_dwmac_init(struct platform_device *pdev, void *priv)
if (!stpriv)
return -EINVAL;
- /* Assert reset to the enet controller before changing the phy mode */
- if (stpriv->stmmac_rst)
- reset_control_assert(stpriv->stmmac_rst);
-
/* Setup the phy mode in the system manager registers according to
* devicetree configuration
*/
ret = socfpga_dwmac_setup(dwmac);
- /* Deassert reset for the phy configuration to be sampled by
- * the enet controller, and operation to start in requested mode
- */
- if (stpriv->stmmac_rst)
- reset_control_deassert(stpriv->stmmac_rst);
-
/* Before the enet controller is suspended, the phy is suspended.
* This causes the phy clock to be gated. The enet controller is
* resumed before the phy, so the clock is still gated "off" when
@@ -264,8 +265,18 @@ static int socfpga_dwmac_probe(struct platform_device *pdev)
plat_dat->fix_mac_speed = socfpga_dwmac_fix_mac_speed;
ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
- if (!ret)
+ if (!ret) {
+ struct net_device *ndev = platform_get_drvdata(pdev);
+ struct stmmac_priv *stpriv = netdev_priv(ndev);
+
+ /* The socfpga driver needs to control the stmmac reset to
+ * set the phy mode. Create a copy of the core reset handel
+ * so it can be used by the driver later.
+ */
+ dwmac->stmmac_rst = stpriv->stmmac_rst;
+
ret = socfpga_dwmac_init(pdev, dwmac);
+ }
return ret;
}
--
2.8.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net-next 4/5] stmmac: dwmac-socfpga: call phy_resume() only in resume callback
2016-04-26 21:24 [PATCH net-next 0/5] stmmac: dwmac-socfpga refactor+cleanup Joachim Eastwood
` (2 preceding siblings ...)
2016-04-26 21:24 ` [PATCH net-next 3/5] stmmac: dwmac-socfpga: keep a copy of stmmac_rst in driver priv data Joachim Eastwood
@ 2016-04-26 21:24 ` Joachim Eastwood
2016-04-26 21:24 ` [PATCH net-next 5/5] stmmac: dwmac-socfpga: kill init() and rename setup() to set_phy_mode() Joachim Eastwood
2016-04-28 20:53 ` [PATCH net-next 0/5] stmmac: dwmac-socfpga refactor+cleanup David Miller
5 siblings, 0 replies; 7+ messages in thread
From: Joachim Eastwood @ 2016-04-26 21:24 UTC (permalink / raw)
To: davem
Cc: Joachim Eastwood, marex, dinguyen, peppe.cavallaro,
alexandre.torgue, netdev
Calling phy_resume() should only be need during driver resume to
workaround a hardware errata.
Signed-off-by: Joachim Eastwood <manabian@gmail.com>
Tested-by: Marek Vasut <marex@denx.de>
---
.../net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 50 ++++++++--------------
1 file changed, 19 insertions(+), 31 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
index ba0b793..ba49d8c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
@@ -198,41 +198,11 @@ static int socfpga_dwmac_setup(struct socfpga_dwmac *dwmac)
static int socfpga_dwmac_init(struct platform_device *pdev, void *priv)
{
struct socfpga_dwmac *dwmac = priv;
- struct net_device *ndev = platform_get_drvdata(pdev);
- struct stmmac_priv *stpriv = NULL;
- int ret = 0;
-
- if (!ndev)
- return -EINVAL;
-
- stpriv = netdev_priv(ndev);
- if (!stpriv)
- return -EINVAL;
/* Setup the phy mode in the system manager registers according to
* devicetree configuration
*/
- ret = socfpga_dwmac_setup(dwmac);
-
- /* Before the enet controller is suspended, the phy is suspended.
- * This causes the phy clock to be gated. The enet controller is
- * resumed before the phy, so the clock is still gated "off" when
- * the enet controller is resumed. This code makes sure the phy
- * is "resumed" before reinitializing the enet controller since
- * the enet controller depends on an active phy clock to complete
- * a DMA reset. A DMA reset will "time out" if executed
- * with no phy clock input on the Synopsys enet controller.
- * Verified through Synopsys Case #8000711656.
- *
- * Note that the phy clock is also gated when the phy is isolated.
- * Phy "suspend" and "isolate" controls are located in phy basic
- * control register 0, and can be modified by the phy driver
- * framework.
- */
- if (stpriv->phydev)
- phy_resume(stpriv->phydev);
-
- return ret;
+ return socfpga_dwmac_setup(dwmac);
}
static int socfpga_dwmac_probe(struct platform_device *pdev)
@@ -290,6 +260,24 @@ static int socfpga_dwmac_resume(struct device *dev)
socfpga_dwmac_init(pdev, priv->plat->bsp_priv);
+ /* Before the enet controller is suspended, the phy is suspended.
+ * This causes the phy clock to be gated. The enet controller is
+ * resumed before the phy, so the clock is still gated "off" when
+ * the enet controller is resumed. This code makes sure the phy
+ * is "resumed" before reinitializing the enet controller since
+ * the enet controller depends on an active phy clock to complete
+ * a DMA reset. A DMA reset will "time out" if executed
+ * with no phy clock input on the Synopsys enet controller.
+ * Verified through Synopsys Case #8000711656.
+ *
+ * Note that the phy clock is also gated when the phy is isolated.
+ * Phy "suspend" and "isolate" controls are located in phy basic
+ * control register 0, and can be modified by the phy driver
+ * framework.
+ */
+ if (priv->phydev)
+ phy_resume(priv->phydev);
+
return stmmac_resume(dev);
}
#endif /* CONFIG_PM_SLEEP */
--
2.8.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net-next 5/5] stmmac: dwmac-socfpga: kill init() and rename setup() to set_phy_mode()
2016-04-26 21:24 [PATCH net-next 0/5] stmmac: dwmac-socfpga refactor+cleanup Joachim Eastwood
` (3 preceding siblings ...)
2016-04-26 21:24 ` [PATCH net-next 4/5] stmmac: dwmac-socfpga: call phy_resume() only in resume callback Joachim Eastwood
@ 2016-04-26 21:24 ` Joachim Eastwood
2016-04-28 20:53 ` [PATCH net-next 0/5] stmmac: dwmac-socfpga refactor+cleanup David Miller
5 siblings, 0 replies; 7+ messages in thread
From: Joachim Eastwood @ 2016-04-26 21:24 UTC (permalink / raw)
To: davem
Cc: Joachim Eastwood, marex, dinguyen, peppe.cavallaro,
alexandre.torgue, netdev
Remove old init callback which now contains only a call to
socfpga_dwmac_setup(). Also rename socfpga_dwmac_setup() to indicate
what the function really does.
Signed-off-by: Joachim Eastwood <manabian@gmail.com>
Tested-by: Marek Vasut <marex@denx.de>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 17 +++--------------
1 file changed, 3 insertions(+), 14 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
index ba49d8c..cd9764a 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
@@ -136,7 +136,7 @@ static int socfpga_dwmac_parse_data(struct socfpga_dwmac *dwmac, struct device *
return 0;
}
-static int socfpga_dwmac_setup(struct socfpga_dwmac *dwmac)
+static int socfpga_dwmac_set_phy_mode(struct socfpga_dwmac *dwmac)
{
struct regmap *sys_mgr_base_addr = dwmac->sys_mgr_base_addr;
int phymode = dwmac->interface;
@@ -195,16 +195,6 @@ static int socfpga_dwmac_setup(struct socfpga_dwmac *dwmac)
return 0;
}
-static int socfpga_dwmac_init(struct platform_device *pdev, void *priv)
-{
- struct socfpga_dwmac *dwmac = priv;
-
- /* Setup the phy mode in the system manager registers according to
- * devicetree configuration
- */
- return socfpga_dwmac_setup(dwmac);
-}
-
static int socfpga_dwmac_probe(struct platform_device *pdev)
{
struct plat_stmmacenet_data *plat_dat;
@@ -245,7 +235,7 @@ static int socfpga_dwmac_probe(struct platform_device *pdev)
*/
dwmac->stmmac_rst = stpriv->stmmac_rst;
- ret = socfpga_dwmac_init(pdev, dwmac);
+ ret = socfpga_dwmac_set_phy_mode(dwmac);
}
return ret;
@@ -254,11 +244,10 @@ static int socfpga_dwmac_probe(struct platform_device *pdev)
#ifdef CONFIG_PM_SLEEP
static int socfpga_dwmac_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
struct net_device *ndev = dev_get_drvdata(dev);
struct stmmac_priv *priv = netdev_priv(ndev);
- socfpga_dwmac_init(pdev, priv->plat->bsp_priv);
+ socfpga_dwmac_set_phy_mode(priv->plat->bsp_priv);
/* Before the enet controller is suspended, the phy is suspended.
* This causes the phy clock to be gated. The enet controller is
--
2.8.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH net-next 0/5] stmmac: dwmac-socfpga refactor+cleanup
2016-04-26 21:24 [PATCH net-next 0/5] stmmac: dwmac-socfpga refactor+cleanup Joachim Eastwood
` (4 preceding siblings ...)
2016-04-26 21:24 ` [PATCH net-next 5/5] stmmac: dwmac-socfpga: kill init() and rename setup() to set_phy_mode() Joachim Eastwood
@ 2016-04-28 20:53 ` David Miller
5 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2016-04-28 20:53 UTC (permalink / raw)
To: manabian; +Cc: marex, dinguyen, peppe.cavallaro, alexandre.torgue, netdev
From: Joachim Eastwood <manabian@gmail.com>
Date: Tue, 26 Apr 2016 23:24:54 +0200
> Couple of heads-up here:
> 1. This patch set depend on Marek's "Remove re-registration of
> reset controller" patch [1] which is not in net-next yet.
> Without that patch this set will not apply!
>
> 2. The first patch changes the prototype of a couple of
> functions used in Alexandre's "add Ethernet glue logic for
> stm32 chip" patch [2] and will cause build failures for
> dwmac-stm32.c if not fixed up!
> If Alexandre's patch set is applied first I will gladly
> rebase my patch set to account for his driver as well.
...
> Dave: Please let me know if you have any preferred way of
> handling this.
You could cherry pick the patch in #1 and add it to this patch set,
in fact please respin this series that way.
For #2 it'll get sorted based upon who gets applied first.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-04-28 20:53 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-26 21:24 [PATCH net-next 0/5] stmmac: dwmac-socfpga refactor+cleanup Joachim Eastwood
2016-04-26 21:24 ` [PATCH net-next 1/5] stmmac: let remove/resume/suspend functions take device pointer Joachim Eastwood
2016-04-26 21:24 ` [PATCH net-next 2/5] stmmac: dwmac-socfpga: add PM ops and resume function Joachim Eastwood
2016-04-26 21:24 ` [PATCH net-next 3/5] stmmac: dwmac-socfpga: keep a copy of stmmac_rst in driver priv data Joachim Eastwood
2016-04-26 21:24 ` [PATCH net-next 4/5] stmmac: dwmac-socfpga: call phy_resume() only in resume callback Joachim Eastwood
2016-04-26 21:24 ` [PATCH net-next 5/5] stmmac: dwmac-socfpga: kill init() and rename setup() to set_phy_mode() Joachim Eastwood
2016-04-28 20:53 ` [PATCH net-next 0/5] stmmac: dwmac-socfpga refactor+cleanup David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).