From 8405996ff6d89bbf275a206eb69d10b98a8d5257 Mon Sep 17 00:00:00 2001 From: Sedji Gaouaou Date: Wed, 25 Jun 2008 10:32:50 +0200 Subject: atmel_pwm: Rename the "mck" clock to "pwm_clk" The name "mck" causes a conflict on AT91. Call it "pwm_clk" instead. Signed-off-by: Sedji Gaouaou Signed-off-by: Haavard Skinnemoen --- drivers/misc/atmel_pwm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/misc/atmel_pwm.c b/drivers/misc/atmel_pwm.c index 0d5ce03cdff..5b5a14dab3d 100644 --- a/drivers/misc/atmel_pwm.c +++ b/drivers/misc/atmel_pwm.c @@ -332,7 +332,7 @@ static int __init pwm_probe(struct platform_device *pdev) p->base = ioremap(r->start, r->end - r->start + 1); if (!p->base) goto fail; - p->clk = clk_get(&pdev->dev, "mck"); + p->clk = clk_get(&pdev->dev, "pwm_clk"); if (IS_ERR(p->clk)) { status = PTR_ERR(p->clk); p->clk = NULL; -- cgit v1.2.3 From f826caa44902ddbe93174f0b642d8abf9698c08e Mon Sep 17 00:00:00 2001 From: Haavard Skinnemoen Date: Sun, 24 Feb 2008 14:34:45 +0100 Subject: atmel_serial: Fix build on avr32 with CONFIG_PM enabled AVR32 doesn't have at91_suspend_entering_slow_clock(). Just assume the clock will keep running for now. David has a better solution for this, but this works for now. Leaving the USART clock running won't prevent the PM code from entering deep power-down modes anyway. Signed-off-by: Haavard Skinnemoen Cc: David Brownell Cc: Andrew Victor --- drivers/serial/atmel_serial.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c index 42be8b01a40..5f0414fc1b1 100644 --- a/drivers/serial/atmel_serial.c +++ b/drivers/serial/atmel_serial.c @@ -1439,6 +1439,15 @@ static struct uart_driver atmel_uart = { }; #ifdef CONFIG_PM +static bool atmel_serial_clk_will_stop(void) +{ +#ifdef CONFIG_ARCH_AT91 + return at91_suspend_entering_slow_clock(); +#else + return false; +#endif +} + static int atmel_serial_suspend(struct platform_device *pdev, pm_message_t state) { @@ -1446,7 +1455,7 @@ static int atmel_serial_suspend(struct platform_device *pdev, struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); if (device_may_wakeup(&pdev->dev) - && !at91_suspend_entering_slow_clock()) + && !atmel_serial_clk_will_stop()) enable_irq_wake(port->irq); else { uart_suspend_port(&atmel_uart, port); -- cgit v1.2.3 From e1c609efbc0333840f2af2d875ca52ed8ee18587 Mon Sep 17 00:00:00 2001 From: Haavard Skinnemoen Date: Fri, 14 Mar 2008 14:54:13 +0100 Subject: atmel_serial: Drain console TX shifter before suspending Funny things may happen if we stop the USART clock before the shifter is empty. Prevent this from happening by waiting until the shifter is completely drained before allowing suspend to continue. Signed-off-by: Haavard Skinnemoen Cc: Andrew Victor --- drivers/serial/atmel_serial.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'drivers') diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c index 5f0414fc1b1..6aeef22bd20 100644 --- a/drivers/serial/atmel_serial.c +++ b/drivers/serial/atmel_serial.c @@ -1454,6 +1454,12 @@ static int atmel_serial_suspend(struct platform_device *pdev, struct uart_port *port = platform_get_drvdata(pdev); struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); + if (atmel_is_console_port(port) && console_suspend_enabled) { + /* Drain the TX shifter */ + while (!(UART_GET_CSR(port) & ATMEL_US_TXEMPTY)) + cpu_relax(); + } + if (device_may_wakeup(&pdev->dev) && !atmel_serial_clk_will_stop()) enable_irq_wake(port->irq); -- cgit v1.2.3 From c1f598fd71db6a971ee88311167c8003243ebff2 Mon Sep 17 00:00:00 2001 From: Haavard Skinnemoen Date: Tue, 4 Mar 2008 13:39:29 +0100 Subject: macb: Basic suspend/resume support This implements suspend and resume callbacks for the macb driver. We may have to do some more to gracefully shut the MAC down, but this at least prevents the macb from waking the system when hooked up to a busy network. Signed-off-by: Haavard Skinnemoen Cc: Jeff Garzik Cc: Patrice Vilchez Cc: Nicolas FERRE --- drivers/net/macb.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'drivers') diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 92dccd43bdc..0a5745a854c 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -1277,8 +1277,45 @@ static int __exit macb_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_PM +static int macb_suspend(struct platform_device *pdev, pm_message_t state) +{ + struct net_device *netdev = platform_get_drvdata(pdev); + struct macb *bp = netdev_priv(netdev); + + netif_device_detach(netdev); + +#ifndef CONFIG_ARCH_AT91 + clk_disable(bp->hclk); +#endif + clk_disable(bp->pclk); + + return 0; +} + +static int macb_resume(struct platform_device *pdev) +{ + struct net_device *netdev = platform_get_drvdata(pdev); + struct macb *bp = netdev_priv(netdev); + + clk_enable(bp->pclk); +#ifndef CONFIG_ARCH_AT91 + clk_enable(bp->hclk); +#endif + + netif_device_attach(netdev); + + return 0; +} +#else +#define macb_suspend NULL +#define macb_resume NULL +#endif + static struct platform_driver macb_driver = { .remove = __exit_p(macb_remove), + .suspend = macb_suspend, + .resume = macb_resume, .driver = { .name = "macb", .owner = THIS_MODULE, -- cgit v1.2.3 From f3a24e1e272f844a4d14a39731b4fa946ba36adc Mon Sep 17 00:00:00 2001 From: Haavard Skinnemoen Date: Mon, 30 Jun 2008 10:54:31 +0200 Subject: rtc-at32ap700x: Enable wakeup Call device_init_wakeup() to signal that the RTC is capable of waking the system. This is needed for rtcwake to work. Signed-off-by: Haavard Skinnemoen Cc: Hans-Christian Egtvedt Cc: Alessandro Zummo --- drivers/rtc/rtc-at32ap700x.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers') diff --git a/drivers/rtc/rtc-at32ap700x.c b/drivers/rtc/rtc-at32ap700x.c index 2ef8cdfda4a..90b9a6503e1 100644 --- a/drivers/rtc/rtc-at32ap700x.c +++ b/drivers/rtc/rtc-at32ap700x.c @@ -265,6 +265,7 @@ static int __init at32_rtc_probe(struct platform_device *pdev) } platform_set_drvdata(pdev, rtc); + device_init_wakeup(&pdev->dev, 1); dev_info(&pdev->dev, "Atmel RTC for AT32AP700x at %08lx irq %ld\n", (unsigned long)rtc->regs, rtc->irq); @@ -284,6 +285,8 @@ static int __exit at32_rtc_remove(struct platform_device *pdev) { struct rtc_at32ap700x *rtc = platform_get_drvdata(pdev); + device_init_wakeup(&pdev->dev, 0); + free_irq(rtc->irq, rtc); iounmap(rtc->regs); rtc_device_unregister(rtc->rtc); -- cgit v1.2.3