Skip to content

Commit

Permalink
MLK-9786 net: fec: Add busfreq support to the driver
Browse files Browse the repository at this point in the history
Add request_bus_freq() and release_bus_freq() calls to the
various drivers to ensure that the DDR and AHB are the requested
frequency before the driver starts its task.

Signed-off-by: Fugang Duan <B38611@freescale.com>
  • Loading branch information
Fugang Duan authored and mk01 committed Oct 18, 2015
1 parent e531e7b commit df09d17
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions drivers/net/ethernet/freescale/fec_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2840,6 +2840,7 @@ fec_enet_open(struct net_device *ndev)
device_set_wakeup_enable(&ndev->dev, fep->wol_flag &
FEC_WOL_FLAG_ENABLE);

pm_runtime_get_sync(ndev->dev.parent);
if ((id_entry->driver_data & FEC_QUIRK_BUG_WAITMODE) &&
!fec_enet_irq_workaround(fep))
pm_qos_add_request(&fep->pm_qos_req,
Expand Down Expand Up @@ -2877,8 +2878,9 @@ fec_enet_close(struct net_device *ndev)
fep->phy_dev = NULL;

fec_enet_clk_enable(ndev, false);
pm_qos_remove_request(&ndev->pm_qos_req);
pm_qos_remove_request(&fep->pm_qos_req);
pinctrl_pm_select_sleep_state(&fep->pdev->dev);
pm_runtime_put_sync_suspend(ndev->dev.parent);
fec_enet_free_buffers(ndev);

return 0;
Expand Down Expand Up @@ -3392,6 +3394,7 @@ fec_probe(struct platform_device *pdev)
fep->bufdesc_ex = false;
}

pm_runtime_enable(&pdev->dev);
ret = fec_enet_clk_enable(ndev, true);
if (ret)
goto failed_clk;
Expand Down Expand Up @@ -3580,7 +3583,22 @@ static int __maybe_unused fec_resume(struct device *dev)
return ret;
}

static SIMPLE_DEV_PM_OPS(fec_pm_ops, fec_suspend, fec_resume);
static int fec_runtime_suspend(struct device *dev)
{
release_bus_freq(BUS_FREQ_HIGH);
return 0;
}

static int fec_runtime_resume(struct device *dev)
{
request_bus_freq(BUS_FREQ_HIGH);
return 0;
}

static const struct dev_pm_ops fec_pm_ops = {
SET_RUNTIME_PM_OPS(fec_runtime_suspend, fec_runtime_resume, NULL)
SET_SYSTEM_SLEEP_PM_OPS(fec_suspend, fec_resume)
};

static struct platform_driver fec_driver = {
.driver = {
Expand Down

0 comments on commit df09d17

Please sign in to comment.