diff options
author | Andrew Victor <andrew@sanpeople.com> | 2006-06-20 06:19:13 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-06-22 22:56:21 -0400 |
commit | 00e5edcbfdb7030f6cbb8d5d89fdc2848133a182 (patch) | |
tree | db1e8bc9e3ff9adbf78b7695bd566f9681567e98 /drivers | |
parent | 427d269f17fd02d192e9ae3bd93bdc07790fa02c (diff) |
[PATCH] AT91RM9200 Ethernet #4: Suspend/Resume
Adds power-management (suspend/resume) support to the AT91RM9200
Ethernet driver.
Patch from David Brownell.
Signed-off-by: Andrew Victor <andrew@sanpeople.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-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, |