Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts: arch/s390/net/bpf_jit_comp.c drivers/net/ethernet/ti/netcp_ethss.c net/bridge/br_multicast.c net/ipv4/ip_fragment.c All four conflicts were cases of simple overlapping changes. Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
@@ -562,6 +562,7 @@ struct fec_enet_private {
|
||||
};
|
||||
|
||||
void fec_ptp_init(struct platform_device *pdev);
|
||||
void fec_ptp_stop(struct platform_device *pdev);
|
||||
void fec_ptp_start_cyclecounter(struct net_device *ndev);
|
||||
int fec_ptp_set(struct net_device *ndev, struct ifreq *ifr);
|
||||
int fec_ptp_get(struct net_device *ndev, struct ifreq *ifr);
|
||||
|
@@ -24,6 +24,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/ptrace.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/ioport.h>
|
||||
@@ -77,6 +78,7 @@ static void fec_enet_itr_coal_init(struct net_device *ndev);
|
||||
#define FEC_ENET_RAEM_V 0x8
|
||||
#define FEC_ENET_RAFL_V 0x8
|
||||
#define FEC_ENET_OPD_V 0xFFF0
|
||||
#define FEC_MDIO_PM_TIMEOUT 100 /* ms */
|
||||
|
||||
static struct platform_device_id fec_devtype[] = {
|
||||
{
|
||||
@@ -1767,7 +1769,13 @@ static void fec_enet_adjust_link(struct net_device *ndev)
|
||||
static int fec_enet_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
|
||||
{
|
||||
struct fec_enet_private *fep = bus->priv;
|
||||
struct device *dev = &fep->pdev->dev;
|
||||
unsigned long time_left;
|
||||
int ret = 0;
|
||||
|
||||
ret = pm_runtime_get_sync(dev);
|
||||
if (IS_ERR_VALUE(ret))
|
||||
return ret;
|
||||
|
||||
fep->mii_timeout = 0;
|
||||
init_completion(&fep->mdio_done);
|
||||
@@ -1783,18 +1791,30 @@ static int fec_enet_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
|
||||
if (time_left == 0) {
|
||||
fep->mii_timeout = 1;
|
||||
netdev_err(fep->netdev, "MDIO read timeout\n");
|
||||
return -ETIMEDOUT;
|
||||
ret = -ETIMEDOUT;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* return value */
|
||||
return FEC_MMFR_DATA(readl(fep->hwp + FEC_MII_DATA));
|
||||
ret = FEC_MMFR_DATA(readl(fep->hwp + FEC_MII_DATA));
|
||||
|
||||
out:
|
||||
pm_runtime_mark_last_busy(dev);
|
||||
pm_runtime_put_autosuspend(dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int fec_enet_mdio_write(struct mii_bus *bus, int mii_id, int regnum,
|
||||
u16 value)
|
||||
{
|
||||
struct fec_enet_private *fep = bus->priv;
|
||||
struct device *dev = &fep->pdev->dev;
|
||||
unsigned long time_left;
|
||||
int ret = 0;
|
||||
|
||||
ret = pm_runtime_get_sync(dev);
|
||||
if (IS_ERR_VALUE(ret))
|
||||
return ret;
|
||||
|
||||
fep->mii_timeout = 0;
|
||||
init_completion(&fep->mdio_done);
|
||||
@@ -1811,10 +1831,13 @@ static int fec_enet_mdio_write(struct mii_bus *bus, int mii_id, int regnum,
|
||||
if (time_left == 0) {
|
||||
fep->mii_timeout = 1;
|
||||
netdev_err(fep->netdev, "MDIO write timeout\n");
|
||||
return -ETIMEDOUT;
|
||||
ret = -ETIMEDOUT;
|
||||
}
|
||||
|
||||
return 0;
|
||||
pm_runtime_mark_last_busy(dev);
|
||||
pm_runtime_put_autosuspend(dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int fec_enet_clk_enable(struct net_device *ndev, bool enable)
|
||||
@@ -1826,9 +1849,6 @@ static int fec_enet_clk_enable(struct net_device *ndev, bool enable)
|
||||
ret = clk_prepare_enable(fep->clk_ahb);
|
||||
if (ret)
|
||||
return ret;
|
||||
ret = clk_prepare_enable(fep->clk_ipg);
|
||||
if (ret)
|
||||
goto failed_clk_ipg;
|
||||
if (fep->clk_enet_out) {
|
||||
ret = clk_prepare_enable(fep->clk_enet_out);
|
||||
if (ret)
|
||||
@@ -1852,7 +1872,6 @@ static int fec_enet_clk_enable(struct net_device *ndev, bool enable)
|
||||
}
|
||||
} else {
|
||||
clk_disable_unprepare(fep->clk_ahb);
|
||||
clk_disable_unprepare(fep->clk_ipg);
|
||||
if (fep->clk_enet_out)
|
||||
clk_disable_unprepare(fep->clk_enet_out);
|
||||
if (fep->clk_ptp) {
|
||||
@@ -1874,8 +1893,6 @@ failed_clk_ptp:
|
||||
if (fep->clk_enet_out)
|
||||
clk_disable_unprepare(fep->clk_enet_out);
|
||||
failed_clk_enet_out:
|
||||
clk_disable_unprepare(fep->clk_ipg);
|
||||
failed_clk_ipg:
|
||||
clk_disable_unprepare(fep->clk_ahb);
|
||||
|
||||
return ret;
|
||||
@@ -2847,10 +2864,14 @@ fec_enet_open(struct net_device *ndev)
|
||||
struct fec_enet_private *fep = netdev_priv(ndev);
|
||||
int ret;
|
||||
|
||||
ret = pm_runtime_get_sync(&fep->pdev->dev);
|
||||
if (IS_ERR_VALUE(ret))
|
||||
return ret;
|
||||
|
||||
pinctrl_pm_select_default_state(&fep->pdev->dev);
|
||||
ret = fec_enet_clk_enable(ndev, true);
|
||||
if (ret)
|
||||
return ret;
|
||||
goto clk_enable;
|
||||
|
||||
/* I should reset the ring buffers here, but I don't yet know
|
||||
* a simple way to do that.
|
||||
@@ -2881,6 +2902,9 @@ err_enet_mii_probe:
|
||||
fec_enet_free_buffers(ndev);
|
||||
err_enet_alloc:
|
||||
fec_enet_clk_enable(ndev, false);
|
||||
clk_enable:
|
||||
pm_runtime_mark_last_busy(&fep->pdev->dev);
|
||||
pm_runtime_put_autosuspend(&fep->pdev->dev);
|
||||
pinctrl_pm_select_sleep_state(&fep->pdev->dev);
|
||||
return ret;
|
||||
}
|
||||
@@ -2903,6 +2927,9 @@ fec_enet_close(struct net_device *ndev)
|
||||
|
||||
fec_enet_clk_enable(ndev, false);
|
||||
pinctrl_pm_select_sleep_state(&fep->pdev->dev);
|
||||
pm_runtime_mark_last_busy(&fep->pdev->dev);
|
||||
pm_runtime_put_autosuspend(&fep->pdev->dev);
|
||||
|
||||
fec_enet_free_buffers(ndev);
|
||||
|
||||
return 0;
|
||||
@@ -3115,8 +3142,8 @@ static int fec_enet_init(struct net_device *ndev)
|
||||
fep->bufdesc_size;
|
||||
|
||||
/* Allocate memory for buffer descriptors. */
|
||||
cbd_base = dma_alloc_coherent(NULL, bd_size, &bd_dma,
|
||||
GFP_KERNEL);
|
||||
cbd_base = dmam_alloc_coherent(&fep->pdev->dev, bd_size, &bd_dma,
|
||||
GFP_KERNEL);
|
||||
if (!cbd_base) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
@@ -3388,6 +3415,10 @@ fec_probe(struct platform_device *pdev)
|
||||
if (ret)
|
||||
goto failed_clk;
|
||||
|
||||
ret = clk_prepare_enable(fep->clk_ipg);
|
||||
if (ret)
|
||||
goto failed_clk_ipg;
|
||||
|
||||
fep->reg_phy = devm_regulator_get(&pdev->dev, "phy");
|
||||
if (!IS_ERR(fep->reg_phy)) {
|
||||
ret = regulator_enable(fep->reg_phy);
|
||||
@@ -3400,6 +3431,11 @@ fec_probe(struct platform_device *pdev)
|
||||
fep->reg_phy = NULL;
|
||||
}
|
||||
|
||||
pm_runtime_set_autosuspend_delay(&pdev->dev, FEC_MDIO_PM_TIMEOUT);
|
||||
pm_runtime_use_autosuspend(&pdev->dev);
|
||||
pm_runtime_set_active(&pdev->dev);
|
||||
pm_runtime_enable(&pdev->dev);
|
||||
|
||||
fec_reset_phy(pdev);
|
||||
|
||||
if (fep->bufdesc_ex)
|
||||
@@ -3447,6 +3483,10 @@ fec_probe(struct platform_device *pdev)
|
||||
|
||||
fep->rx_copybreak = COPYBREAK_DEFAULT;
|
||||
INIT_WORK(&fep->tx_timeout_work, fec_enet_timeout_work);
|
||||
|
||||
pm_runtime_mark_last_busy(&pdev->dev);
|
||||
pm_runtime_put_autosuspend(&pdev->dev);
|
||||
|
||||
return 0;
|
||||
|
||||
failed_register:
|
||||
@@ -3454,9 +3494,12 @@ failed_register:
|
||||
failed_mii_init:
|
||||
failed_irq:
|
||||
failed_init:
|
||||
fec_ptp_stop(pdev);
|
||||
if (fep->reg_phy)
|
||||
regulator_disable(fep->reg_phy);
|
||||
failed_regulator:
|
||||
clk_disable_unprepare(fep->clk_ipg);
|
||||
failed_clk_ipg:
|
||||
fec_enet_clk_enable(ndev, false);
|
||||
failed_clk:
|
||||
failed_phy:
|
||||
@@ -3473,14 +3516,12 @@ fec_drv_remove(struct platform_device *pdev)
|
||||
struct net_device *ndev = platform_get_drvdata(pdev);
|
||||
struct fec_enet_private *fep = netdev_priv(ndev);
|
||||
|
||||
cancel_delayed_work_sync(&fep->time_keep);
|
||||
cancel_work_sync(&fep->tx_timeout_work);
|
||||
fec_ptp_stop(pdev);
|
||||
unregister_netdev(ndev);
|
||||
fec_enet_mii_remove(fep);
|
||||
if (fep->reg_phy)
|
||||
regulator_disable(fep->reg_phy);
|
||||
if (fep->ptp_clock)
|
||||
ptp_clock_unregister(fep->ptp_clock);
|
||||
of_node_put(fep->phy_node);
|
||||
free_netdev(ndev);
|
||||
|
||||
@@ -3568,7 +3609,28 @@ failed_clk:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(fec_pm_ops, fec_suspend, fec_resume);
|
||||
static int __maybe_unused fec_runtime_suspend(struct device *dev)
|
||||
{
|
||||
struct net_device *ndev = dev_get_drvdata(dev);
|
||||
struct fec_enet_private *fep = netdev_priv(ndev);
|
||||
|
||||
clk_disable_unprepare(fep->clk_ipg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused fec_runtime_resume(struct device *dev)
|
||||
{
|
||||
struct net_device *ndev = dev_get_drvdata(dev);
|
||||
struct fec_enet_private *fep = netdev_priv(ndev);
|
||||
|
||||
return clk_prepare_enable(fep->clk_ipg);
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops fec_pm_ops = {
|
||||
SET_SYSTEM_SLEEP_PM_OPS(fec_suspend, fec_resume)
|
||||
SET_RUNTIME_PM_OPS(fec_runtime_suspend, fec_runtime_resume, NULL)
|
||||
};
|
||||
|
||||
static struct platform_driver fec_driver = {
|
||||
.driver = {
|
||||
|
@@ -598,6 +598,16 @@ void fec_ptp_init(struct platform_device *pdev)
|
||||
schedule_delayed_work(&fep->time_keep, HZ);
|
||||
}
|
||||
|
||||
void fec_ptp_stop(struct platform_device *pdev)
|
||||
{
|
||||
struct net_device *ndev = platform_get_drvdata(pdev);
|
||||
struct fec_enet_private *fep = netdev_priv(ndev);
|
||||
|
||||
cancel_delayed_work_sync(&fep->time_keep);
|
||||
if (fep->ptp_clock)
|
||||
ptp_clock_unregister(fep->ptp_clock);
|
||||
}
|
||||
|
||||
/**
|
||||
* fec_ptp_check_pps_event
|
||||
* @fep: the fec_enet_private structure handle
|
||||
|
@@ -532,22 +532,6 @@ static void gfar_ints_enable(struct gfar_private *priv)
|
||||
}
|
||||
}
|
||||
|
||||
static void lock_tx_qs(struct gfar_private *priv)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < priv->num_tx_queues; i++)
|
||||
spin_lock(&priv->tx_queue[i]->txlock);
|
||||
}
|
||||
|
||||
static void unlock_tx_qs(struct gfar_private *priv)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < priv->num_tx_queues; i++)
|
||||
spin_unlock(&priv->tx_queue[i]->txlock);
|
||||
}
|
||||
|
||||
static int gfar_alloc_tx_queues(struct gfar_private *priv)
|
||||
{
|
||||
int i;
|
||||
@@ -1340,7 +1324,6 @@ static int gfar_probe(struct platform_device *ofdev)
|
||||
priv->dev = &ofdev->dev;
|
||||
SET_NETDEV_DEV(dev, &ofdev->dev);
|
||||
|
||||
spin_lock_init(&priv->bflock);
|
||||
INIT_WORK(&priv->reset_task, gfar_reset_task);
|
||||
|
||||
platform_set_drvdata(ofdev, priv);
|
||||
@@ -1432,9 +1415,8 @@ static int gfar_probe(struct platform_device *ofdev)
|
||||
goto register_fail;
|
||||
}
|
||||
|
||||
device_init_wakeup(&dev->dev,
|
||||
priv->device_flags &
|
||||
FSL_GIANFAR_DEV_HAS_MAGIC_PACKET);
|
||||
device_set_wakeup_capable(&dev->dev, priv->device_flags &
|
||||
FSL_GIANFAR_DEV_HAS_MAGIC_PACKET);
|
||||
|
||||
/* fill out IRQ number and name fields */
|
||||
for (i = 0; i < priv->num_grps; i++) {
|
||||
@@ -1502,48 +1484,37 @@ static int gfar_suspend(struct device *dev)
|
||||
struct gfar_private *priv = dev_get_drvdata(dev);
|
||||
struct net_device *ndev = priv->ndev;
|
||||
struct gfar __iomem *regs = priv->gfargrp[0].regs;
|
||||
unsigned long flags;
|
||||
u32 tempval;
|
||||
|
||||
int magic_packet = priv->wol_en &&
|
||||
(priv->device_flags &
|
||||
FSL_GIANFAR_DEV_HAS_MAGIC_PACKET);
|
||||
|
||||
if (!netif_running(ndev))
|
||||
return 0;
|
||||
|
||||
disable_napi(priv);
|
||||
netif_tx_lock(ndev);
|
||||
netif_device_detach(ndev);
|
||||
netif_tx_unlock(ndev);
|
||||
|
||||
if (netif_running(ndev)) {
|
||||
gfar_halt(priv);
|
||||
|
||||
local_irq_save(flags);
|
||||
lock_tx_qs(priv);
|
||||
if (magic_packet) {
|
||||
/* Enable interrupt on Magic Packet */
|
||||
gfar_write(®s->imask, IMASK_MAG);
|
||||
|
||||
gfar_halt_nodisable(priv);
|
||||
/* Enable Magic Packet mode */
|
||||
tempval = gfar_read(®s->maccfg2);
|
||||
tempval |= MACCFG2_MPEN;
|
||||
gfar_write(®s->maccfg2, tempval);
|
||||
|
||||
/* Disable Tx, and Rx if wake-on-LAN is disabled. */
|
||||
/* re-enable the Rx block */
|
||||
tempval = gfar_read(®s->maccfg1);
|
||||
|
||||
tempval &= ~MACCFG1_TX_EN;
|
||||
|
||||
if (!magic_packet)
|
||||
tempval &= ~MACCFG1_RX_EN;
|
||||
|
||||
tempval |= MACCFG1_RX_EN;
|
||||
gfar_write(®s->maccfg1, tempval);
|
||||
|
||||
unlock_tx_qs(priv);
|
||||
local_irq_restore(flags);
|
||||
|
||||
disable_napi(priv);
|
||||
|
||||
if (magic_packet) {
|
||||
/* Enable interrupt on Magic Packet */
|
||||
gfar_write(®s->imask, IMASK_MAG);
|
||||
|
||||
/* Enable Magic Packet mode */
|
||||
tempval = gfar_read(®s->maccfg2);
|
||||
tempval |= MACCFG2_MPEN;
|
||||
gfar_write(®s->maccfg2, tempval);
|
||||
} else {
|
||||
phy_stop(priv->phydev);
|
||||
}
|
||||
} else {
|
||||
phy_stop(priv->phydev);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -1554,37 +1525,26 @@ static int gfar_resume(struct device *dev)
|
||||
struct gfar_private *priv = dev_get_drvdata(dev);
|
||||
struct net_device *ndev = priv->ndev;
|
||||
struct gfar __iomem *regs = priv->gfargrp[0].regs;
|
||||
unsigned long flags;
|
||||
u32 tempval;
|
||||
int magic_packet = priv->wol_en &&
|
||||
(priv->device_flags &
|
||||
FSL_GIANFAR_DEV_HAS_MAGIC_PACKET);
|
||||
|
||||
if (!netif_running(ndev)) {
|
||||
netif_device_attach(ndev);
|
||||
if (!netif_running(ndev))
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!magic_packet && priv->phydev)
|
||||
if (magic_packet) {
|
||||
/* Disable Magic Packet mode */
|
||||
tempval = gfar_read(®s->maccfg2);
|
||||
tempval &= ~MACCFG2_MPEN;
|
||||
gfar_write(®s->maccfg2, tempval);
|
||||
} else {
|
||||
phy_start(priv->phydev);
|
||||
|
||||
/* Disable Magic Packet mode, in case something
|
||||
* else woke us up.
|
||||
*/
|
||||
local_irq_save(flags);
|
||||
lock_tx_qs(priv);
|
||||
|
||||
tempval = gfar_read(®s->maccfg2);
|
||||
tempval &= ~MACCFG2_MPEN;
|
||||
gfar_write(®s->maccfg2, tempval);
|
||||
}
|
||||
|
||||
gfar_start(priv);
|
||||
|
||||
unlock_tx_qs(priv);
|
||||
local_irq_restore(flags);
|
||||
|
||||
netif_device_attach(ndev);
|
||||
|
||||
enable_napi(priv);
|
||||
|
||||
return 0;
|
||||
@@ -2010,7 +1970,8 @@ static int register_grp_irqs(struct gfar_priv_grp *grp)
|
||||
/* Install our interrupt handlers for Error,
|
||||
* Transmit, and Receive
|
||||
*/
|
||||
err = request_irq(gfar_irq(grp, ER)->irq, gfar_error, 0,
|
||||
err = request_irq(gfar_irq(grp, ER)->irq, gfar_error,
|
||||
IRQF_NO_SUSPEND,
|
||||
gfar_irq(grp, ER)->name, grp);
|
||||
if (err < 0) {
|
||||
netif_err(priv, intr, dev, "Can't get IRQ %d\n",
|
||||
@@ -2033,7 +1994,8 @@ static int register_grp_irqs(struct gfar_priv_grp *grp)
|
||||
goto rx_irq_fail;
|
||||
}
|
||||
} else {
|
||||
err = request_irq(gfar_irq(grp, TX)->irq, gfar_interrupt, 0,
|
||||
err = request_irq(gfar_irq(grp, TX)->irq, gfar_interrupt,
|
||||
IRQF_NO_SUSPEND,
|
||||
gfar_irq(grp, TX)->name, grp);
|
||||
if (err < 0) {
|
||||
netif_err(priv, intr, dev, "Can't get IRQ %d\n",
|
||||
@@ -2134,8 +2096,6 @@ static int gfar_enet_open(struct net_device *dev)
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
device_set_wakeup_enable(&dev->dev, priv->wol_en);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@@ -1152,9 +1152,6 @@ struct gfar_private {
|
||||
int oldduplex;
|
||||
int oldlink;
|
||||
|
||||
/* Bitfield update lock */
|
||||
spinlock_t bflock;
|
||||
|
||||
uint32_t msg_enable;
|
||||
|
||||
struct work_struct reset_task;
|
||||
|
@@ -655,7 +655,6 @@ static void gfar_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
|
||||
static int gfar_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
|
||||
{
|
||||
struct gfar_private *priv = netdev_priv(dev);
|
||||
unsigned long flags;
|
||||
|
||||
if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_MAGIC_PACKET) &&
|
||||
wol->wolopts != 0)
|
||||
@@ -666,9 +665,7 @@ static int gfar_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
|
||||
|
||||
device_set_wakeup_enable(&dev->dev, wol->wolopts & WAKE_MAGIC);
|
||||
|
||||
spin_lock_irqsave(&priv->bflock, flags);
|
||||
priv->wol_en = !!device_may_wakeup(&dev->dev);
|
||||
spin_unlock_irqrestore(&priv->bflock, flags);
|
||||
priv->wol_en = !!device_may_wakeup(&dev->dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user