X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=arch%2Farm%2Fmach-at91%2Fpm.c;h=a67defd504387a2fc610be020695323947b60333;hb=c1f3ee120bb61045b1c0a3ead620d1d65af47130;hp=ff8db29e989e2f39c420a9de219f63b435ace081;hpb=c6799ade4ae04b53a5f677e5289116155ff01574;p=linux-2.6 diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c index ff8db29e98..a67defd504 100644 --- a/arch/arm/mach-at91/pm.c +++ b/arch/arm/mach-at91/pm.c @@ -10,10 +10,9 @@ * (at your option) any later version. */ -#include +#include #include #include -#include #include #include #include @@ -53,7 +52,7 @@ static suspend_state_t target_state; /* * Called after processes are frozen, but before we shutdown devices. */ -static int at91_pm_prepare(suspend_state_t state) +static int at91_pm_begin(suspend_state_t state) { target_state = state; return 0; @@ -76,12 +75,16 @@ static int at91_pm_verify_clocks(void) pr_debug("AT91: PM - Suspend-to-RAM with USB still active\n"); return 0; } - } else if (cpu_is_at91sam9260()) { -#warning "Check SAM9260 USB clocks" - } else if (cpu_is_at91sam9261()) { -#warning "Check SAM9261 USB clocks" - } else if (cpu_is_at91sam9263()) { -#warning "Check SAM9263 USB clocks" + } else if (cpu_is_at91sam9260() || cpu_is_at91sam9261() || cpu_is_at91sam9263()) { + if ((scsr & (AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP)) != 0) { + pr_debug("AT91: PM - Suspend-to-RAM with USB still active\n"); + return 0; + } + } else if (cpu_is_at91cap9()) { + if ((scsr & AT91CAP9_PMC_UHP) != 0) { + pr_debug("AT91: PM - Suspend-to-RAM with USB still active\n"); + return 0; + } } #ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS @@ -199,11 +202,20 @@ error: return 0; } +/* + * Called right prior to thawing processes. + */ +static void at91_pm_end(void) +{ + target_state = PM_SUSPEND_ON; +} + -static struct pm_ops at91_pm_ops ={ - .valid = at91_pm_valid_state, - .prepare = at91_pm_prepare, - .enter = at91_pm_enter, +static struct platform_suspend_ops at91_pm_ops ={ + .valid = at91_pm_valid_state, + .begin = at91_pm_begin, + .enter = at91_pm_enter, + .end = at91_pm_end, }; static int __init at91_pm_init(void) @@ -221,7 +233,7 @@ static int __init at91_pm_init(void) /* Disable SDRAM low-power mode. Cannot be used with self-refresh. */ at91_sys_write(AT91_SDRAMC_LPR, 0); - pm_set_ops(&at91_pm_ops); + suspend_set_ops(&at91_pm_ops); return 0; }