diff options
Diffstat (limited to 'drivers/net/arm/at91_ether.c')
-rw-r--r-- | drivers/net/arm/at91_ether.c | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/drivers/net/arm/at91_ether.c b/drivers/net/arm/at91_ether.c index d081241f613d..613005a0285d 100644 --- a/drivers/net/arm/at91_ether.c +++ b/drivers/net/arm/at91_ether.c | |||
@@ -1128,10 +1128,54 @@ static int __devexit at91ether_remove(struct platform_device *pdev) | |||
1128 | return 0; | 1128 | return 0; |
1129 | } | 1129 | } |
1130 | 1130 | ||
1131 | #ifdef CONFIG_PM | ||
1132 | |||
1133 | static int at91ether_suspend(struct platform_device *pdev, pm_message_t mesg) | ||
1134 | { | ||
1135 | struct at91_private *lp = (struct at91_private *) at91_dev->priv; | ||
1136 | struct net_device *net_dev = platform_get_drvdata(pdev); | ||
1137 | int phy_irq = lp->board_data.phy_irq_pin; | ||
1138 | |||
1139 | if (netif_running(net_dev)) { | ||
1140 | if (phy_irq) | ||
1141 | disable_irq(phy_irq); | ||
1142 | |||
1143 | netif_stop_queue(net_dev); | ||
1144 | netif_device_detach(net_dev); | ||
1145 | |||
1146 | clk_disable(lp->ether_clk); | ||
1147 | } | ||
1148 | return 0; | ||
1149 | } | ||
1150 | |||
1151 | static int at91ether_resume(struct platform_device *pdev) | ||
1152 | { | ||
1153 | struct at91_private *lp = (struct at91_private *) at91_dev->priv; | ||
1154 | struct net_device *net_dev = platform_get_drvdata(pdev); | ||
1155 | int phy_irq = lp->board_data.phy_irq_pin; | ||
1156 | |||
1157 | if (netif_running(net_dev)) { | ||
1158 | clk_enable(lp->ether_clk); | ||
1159 | |||
1160 | netif_device_attach(net_dev); | ||
1161 | netif_start_queue(net_dev); | ||
1162 | |||
1163 | if (phy_irq) | ||
1164 | enable_irq(phy_irq); | ||
1165 | } | ||
1166 | return 0; | ||
1167 | } | ||
1168 | |||
1169 | #else | ||
1170 | #define at91ether_suspend NULL | ||
1171 | #define at91ether_resume NULL | ||
1172 | #endif | ||
1173 | |||
1131 | static struct platform_driver at91ether_driver = { | 1174 | static struct platform_driver at91ether_driver = { |
1132 | .probe = at91ether_probe, | 1175 | .probe = at91ether_probe, |
1133 | .remove = __devexit_p(at91ether_remove), | 1176 | .remove = __devexit_p(at91ether_remove), |
1134 | /* FIXME: support suspend and resume */ | 1177 | .suspend = at91ether_suspend, |
1178 | .resume = at91ether_resume, | ||
1135 | .driver = { | 1179 | .driver = { |
1136 | .name = DRV_NAME, | 1180 | .name = DRV_NAME, |
1137 | .owner = THIS_MODULE, | 1181 | .owner = THIS_MODULE, |