| @@ -39,6 +39,20 @@ extern void at91_pinctrl_gpio_suspend(void); · 38 unmodified lines |
| 39 | 39 | extern void at91_pinctrl_gpio_resume(void); |
| 40 | 40 | #endif |
| 41 | 41 | |
| 42 | +struct at91_soc_pm { |
| 43 | + int (*config_shdwc_ws)(void __iomem *shdwc, u32 *mode, u32 *polarity); |
| 44 | + int (*config_pmc_ws)(void __iomem *pmc, u32 mode, u32 polarity); |
| 45 | + const struct of_device_id *ws_ids; |
| 46 | + struct at91_pm_data data; |
| 47 | +}; |
| 48 | + |
| 49 | +static struct at91_soc_pm soc_pm = { |
| 50 | + .data = { |
| 51 | + .standby_mode = AT91_PM_STANDBY, |
| 52 | + .suspend_mode = AT91_PM_ULP0, |
| 53 | + }, |
| 54 | +}; |
| 55 | + |
| 42 | 56 | static const match_table_t pm_modes __initconst = { |
| 43 | 57 | { AT91_PM_STANDBY, "standby" }, |
| 44 | 58 | { AT91_PM_ULP0, "ulp0" }, |
| @@ -47,16 +61,11 @@ static const match_table_t pm_modes __initconst = { · 2 unmodified lines |
| 47 | 61 | { -1, NULL }, |
| 48 | 62 | }; |
| 49 | 63 | |
| 50 | | −static struct at91_pm_data pm_data = { |
| 51 | | − .standby_mode = AT91_PM_STANDBY, |
| 52 | | − .suspend_mode = AT91_PM_ULP0, |
| 53 | | −}; |
| 54 | | − |
| 55 | 64 | #define at91_ramc_read(id, field) \ |
| 56 | | − __raw_readl(pm_data.ramc[id] + field) |
| 65 | + __raw_readl(soc_pm.data.ramc[id] + field) |
| 57 | 66 | |
| 58 | 67 | #define at91_ramc_write(id, field, value) \ |
| 59 | | − __raw_writel(value, pm_data.ramc[id] + field) |
| 68 | + __raw_writel(value, soc_pm.data.ramc[id] + field) |
| 60 | 69 | |
| 61 | 70 | static int at91_pm_valid_state(suspend_state_t state) |
| 62 | 71 | { |
| @@ -91,6 +100,8 @@ static const struct wakeup_source_info ws_info[] = { · 28 unmodified lines |
| 91 | 100 | { .pmc_fsmr_bit = AT91_PMC_RTCAL, .shdwc_mr_bit = BIT(17) }, |
| 92 | 101 | { .pmc_fsmr_bit = AT91_PMC_USBAL }, |
| 93 | 102 | { .pmc_fsmr_bit = AT91_PMC_SDMMC_CD }, |
| 103 | + { .pmc_fsmr_bit = AT91_PMC_RTTAL }, |
| 104 | + { .pmc_fsmr_bit = AT91_PMC_RXLP_MCE }, |
| 94 | 105 | }; |
| 95 | 106 | |
| 96 | 107 | static const struct of_device_id sama5d2_ws_ids[] = { |
| @@ -105,6 +116,17 @@ static const struct of_device_id sama5d2_ws_ids[] = { · 8 unmodified lines |
| 105 | 116 | { /* sentinel */ } |
| 106 | 117 | }; |
| 107 | 118 | |
| 119 | +static const struct of_device_id sam9x60_ws_ids[] = { |
| 120 | + { .compatible = "atmel,at91sam9x5-rtc", .data = &ws_info[1] }, |
| 121 | + { .compatible = "atmel,at91rm9200-ohci", .data = &ws_info[2] }, |
| 122 | + { .compatible = "usb-ohci", .data = &ws_info[2] }, |
| 123 | + { .compatible = "atmel,at91sam9g45-ehci", .data = &ws_info[2] }, |
| 124 | + { .compatible = "usb-ehci", .data = &ws_info[2] }, |
| 125 | + { .compatible = "atmel,at91sam9260-rtt", .data = &ws_info[4] }, |
| 126 | + { .compatible = "cdns,sam9x60-macb", .data = &ws_info[5] }, |
| 127 | + { /* sentinel */ } |
| 128 | +}; |
| 129 | + |
| 108 | 130 | static int at91_pm_config_ws(unsigned int pm_mode, bool set) |
| 109 | 131 | { |
| 110 | 132 | const struct wakeup_source_info *wsi; |
| @@ -116,24 +138,22 @@ static int at91_pm_config_ws(unsigned int pm_mode, bool set) · 5 unmodified lines |
| 116 | 138 | if (pm_mode != AT91_PM_ULP1) |
| 117 | 139 | return 0; |
| 118 | 140 | |
| 119 | | − if (!pm_data.pmc || !pm_data.shdwc) |
| 141 | + if (!soc_pm.data.pmc || !soc_pm.data.shdwc || !soc_pm.ws_ids) |
| 120 | 142 | return -EPERM; |
| 121 | 143 | |
| 122 | 144 | if (!set) { |
| 123 | | − writel(mode, pm_data.pmc + AT91_PMC_FSMR); |
| 145 | + writel(mode, soc_pm.data.pmc + AT91_PMC_FSMR); |
| 124 | 146 | return 0; |
| 125 | 147 | } |
| 126 | 148 | |
| 127 | | − /* SHDWC.WUIR */ |
| 128 | | − val = readl(pm_data.shdwc + 0x0c); |
| 129 | | − mode |= (val & 0x3ff); |
| 130 | | − polarity |= ((val >> 16) & 0x3ff); |
| 149 | + if (soc_pm.config_shdwc_ws) |
| 150 | + soc_pm.config_shdwc_ws(soc_pm.data.shdwc, &mode, &polarity); |
| 131 | 151 | |
| 132 | 152 | /* SHDWC.MR */ |
| 133 | | − val = readl(pm_data.shdwc + 0x04); |
| 153 | + val = readl(soc_pm.data.shdwc + 0x04); |
| 134 | 154 | |
| 135 | 155 | /* Loop through defined wakeup sources. */ |
| 136 | | − for_each_matching_node_and_match(np, sama5d2_ws_ids, &match) { |
| 156 | + for_each_matching_node_and_match(np, soc_pm.ws_ids, &match) { |
| 137 | 157 | pdev = of_find_device_by_node(np); |
| 138 | 158 | if (!pdev) |
| 139 | 159 | continue; |
| @@ -155,8 +175,8 @@ put_device: · 15 unmodified lines |
| 155 | 175 | } |
| 156 | 176 | |
| 157 | 177 | if (mode) { |
| 158 | | − writel(mode, pm_data.pmc + AT91_PMC_FSMR); |
| 159 | | − writel(polarity, pm_data.pmc + AT91_PMC_FSPR); |
| 178 | + if (soc_pm.config_pmc_ws) |
| 179 | + soc_pm.config_pmc_ws(soc_pm.data.pmc, mode, polarity); |
| 160 | 180 | } else { |
| 161 | 181 | pr_err("AT91: PM: no ULP1 wakeup sources found!"); |
| 162 | 182 | } |
| @@ -164,6 +184,34 @@ put_device: · 1 unmodified line |
| 164 | 184 | return mode ? 0 : -EPERM; |
| 165 | 185 | } |
| 166 | 186 | |
| 187 | +static int at91_sama5d2_config_shdwc_ws(void __iomem *shdwc, u32 *mode, |
| 188 | + u32 *polarity) |
| 189 | +{ |
| 190 | + u32 val; |
| 191 | + |
| 192 | + /* SHDWC.WUIR */ |
| 193 | + val = readl(shdwc + 0x0c); |
| 194 | + *mode |= (val & 0x3ff); |
| 195 | + *polarity |= ((val >> 16) & 0x3ff); |
| 196 | + |
| 197 | + return 0; |
| 198 | +} |
| 199 | + |
| 200 | +static int at91_sama5d2_config_pmc_ws(void __iomem *pmc, u32 mode, u32 polarity) |
| 201 | +{ |
| 202 | + writel(mode, pmc + AT91_PMC_FSMR); |
| 203 | + writel(polarity, pmc + AT91_PMC_FSPR); |
| 204 | + |
| 205 | + return 0; |
| 206 | +} |
| 207 | + |
| 208 | +static int at91_sam9x60_config_pmc_ws(void __iomem *pmc, u32 mode, u32 polarity) |
| 209 | +{ |
| 210 | + writel(mode, pmc + AT91_PMC_FSMR); |
| 211 | + |
| 212 | + return 0; |
| 213 | +} |
| 214 | + |
| 167 | 215 | /* |
| 168 | 216 | * Called after processes are frozen, but before we shutdown devices. |
| 169 | 217 | */ |
| @@ -171,18 +219,18 @@ static int at91_pm_begin(suspend_state_t state) · 1 unmodified line |
| 171 | 219 | { |
| 172 | 220 | switch (state) { |
| 173 | 221 | case PM_SUSPEND_MEM: |
| 174 | | − pm_data.mode = pm_data.suspend_mode; |
| 222 | + soc_pm.data.mode = soc_pm.data.suspend_mode; |
| 175 | 223 | break; |
| 176 | 224 | |
| 177 | 225 | case PM_SUSPEND_STANDBY: |
| 178 | | − pm_data.mode = pm_data.standby_mode; |
| 226 | + soc_pm.data.mode = soc_pm.data.standby_mode; |
| 179 | 227 | break; |
| 180 | 228 | |
| 181 | 229 | default: |
| 182 | | − pm_data.mode = -1; |
| 230 | + soc_pm.data.mode = -1; |
| 183 | 231 | } |
| 184 | 232 | |
| 185 | | − return at91_pm_config_ws(pm_data.mode, true); |
| 233 | + return at91_pm_config_ws(soc_pm.data.mode, true); |
| 186 | 234 | } |
| 187 | 235 | |
| 188 | 236 | /* |
| @@ -194,10 +242,10 @@ static int at91_pm_verify_clocks(void) · 5 unmodified lines |
| 194 | 242 | unsigned long scsr; |
| 195 | 243 | int i; |
| 196 | 244 | |
| 197 | | − scsr = readl(pm_data.pmc + AT91_PMC_SCSR); |
| 245 | + scsr = readl(soc_pm.data.pmc + AT91_PMC_SCSR); |
| 198 | 246 | |
| 199 | 247 | /* USB must not be using PLLB */ |
| 200 | | − if ((scsr & pm_data.uhp_udp_mask) != 0) { |
| 248 | + if ((scsr & soc_pm.data.uhp_udp_mask) != 0) { |
| 201 | 249 | pr_err("AT91: PM - Suspend-to-RAM with USB still active\n"); |
| 202 | 250 | return 0; |
| 203 | 251 | } |
| @@ -208,7 +256,7 @@ static int at91_pm_verify_clocks(void) · 4 unmodified lines |
| 208 | 256 | |
| 209 | 257 | if ((scsr & (AT91_PMC_PCK0 << i)) == 0) |
| 210 | 258 | continue; |
| 211 | | − css = readl(pm_data.pmc + AT91_PMC_PCKR(i)) & AT91_PMC_CSS; |
| 259 | + css = readl(soc_pm.data.pmc + AT91_PMC_PCKR(i)) & AT91_PMC_CSS; |
| 212 | 260 | if (css != AT91_PMC_CSS_SLOW) { |
| 213 | 261 | pr_err("AT91: PM - Suspend-to-RAM with PCK%d src %d\n", i, css); |
| 214 | 262 | return 0; |
| @@ -230,7 +278,7 @@ static int at91_pm_verify_clocks(void) · 15 unmodified lines |
| 230 | 278 | */ |
| 231 | 279 | int at91_suspend_entering_slow_clock(void) |
| 232 | 280 | { |
| 233 | | − return (pm_data.mode >= AT91_PM_ULP0); |
| 281 | + return (soc_pm.data.mode >= AT91_PM_ULP0); |
| 234 | 282 | } |
| 235 | 283 | EXPORT_SYMBOL(at91_suspend_entering_slow_clock); |
| 236 | 284 | |
| @@ -243,14 +291,14 @@ static int at91_suspend_finish(unsigned long val) · 6 unmodified lines |
| 243 | 291 | flush_cache_all(); |
| 244 | 292 | outer_disable(); |
| 245 | 293 | |
| 246 | | − at91_suspend_sram_fn(&pm_data); |
| 294 | + at91_suspend_sram_fn(&soc_pm.data); |
| 247 | 295 | |
| 248 | 296 | return 0; |
| 249 | 297 | } |
| 250 | 298 | |
| 251 | 299 | static void at91_pm_suspend(suspend_state_t state) |
| 252 | 300 | { |
| 253 | | − if (pm_data.mode == AT91_PM_BACKUP) { |
| 301 | + if (soc_pm.data.mode == AT91_PM_BACKUP) { |
| 254 | 302 | pm_bu->suspended = 1; |
| 255 | 303 | |
| 256 | 304 | cpu_suspend(0, at91_suspend_finish); |
| @@ -289,7 +337,7 @@ static int at91_pm_enter(suspend_state_t state) · 32 unmodified lines |
| 289 | 337 | /* |
| 290 | 338 | * Ensure that clocks are in a valid state. |
| 291 | 339 | */ |
| 292 | | − if (pm_data.mode >= AT91_PM_ULP0 && |
| 340 | + if (soc_pm.data.mode >= AT91_PM_ULP0 && |
| 293 | 341 | !at91_pm_verify_clocks()) |
| 294 | 342 | goto error; |
| 295 | 343 | |
| @@ -318,7 +366,7 @@ error: · 22 unmodified lines |
| 318 | 366 | */ |
| 319 | 367 | static void at91_pm_end(void) |
| 320 | 368 | { |
| 321 | | − at91_pm_config_ws(pm_data.mode, false); |
| 369 | + at91_pm_config_ws(soc_pm.data.mode, false); |
| 322 | 370 | } |
| 323 | 371 | |
| 324 | 372 | |
| @@ -351,7 +399,7 @@ static void at91rm9200_standby(void) · 26 unmodified lines |
| 351 | 399 | " str %2, [%1, %3]\n\t" |
| 352 | 400 | " mcr p15, 0, %0, c7, c0, 4\n\t" |
| 353 | 401 | : |
| 354 | | − : "r" (0), "r" (pm_data.ramc[0]), |
| 402 | + : "r" (0), "r" (soc_pm.data.ramc[0]), |
| 355 | 403 | "r" (1), "r" (AT91_MC_SDRAMC_SRR)); |
| 356 | 404 | } |
| 357 | 405 | |
| @@ -374,7 +422,7 @@ static void at91_ddr_standby(void) · 16 unmodified lines |
| 374 | 422 | at91_ramc_write(0, AT91_DDRSDRC_MDR, mdr); |
| 375 | 423 | } |
| 376 | 424 | |
| 377 | | − if (pm_data.ramc[1]) { |
| 425 | + if (soc_pm.data.ramc[1]) { |
| 378 | 426 | saved_lpr1 = at91_ramc_read(1, AT91_DDRSDRC_LPR); |
| 379 | 427 | lpr1 = saved_lpr1 & ~AT91_DDRSDRC_LPCB; |
| 380 | 428 | lpr1 |= AT91_DDRSDRC_LPCB_SELF_REFRESH; |
| @@ -392,14 +440,14 @@ static void at91_ddr_standby(void) · 11 unmodified lines |
| 392 | 440 | |
| 393 | 441 | /* self-refresh mode now */ |
| 394 | 442 | at91_ramc_write(0, AT91_DDRSDRC_LPR, lpr0); |
| 395 | | − if (pm_data.ramc[1]) |
| 443 | + if (soc_pm.data.ramc[1]) |
| 396 | 444 | at91_ramc_write(1, AT91_DDRSDRC_LPR, lpr1); |
| 397 | 445 | |
| 398 | 446 | cpu_do_idle(); |
| 399 | 447 | |
| 400 | 448 | at91_ramc_write(0, AT91_DDRSDRC_MDR, saved_mdr0); |
| 401 | 449 | at91_ramc_write(0, AT91_DDRSDRC_LPR, saved_lpr0); |
| 402 | | − if (pm_data.ramc[1]) { |
| 450 | + if (soc_pm.data.ramc[1]) { |
| 403 | 451 | at91_ramc_write(0, AT91_DDRSDRC_MDR, saved_mdr1); |
| 404 | 452 | at91_ramc_write(1, AT91_DDRSDRC_LPR, saved_lpr1); |
| 405 | 453 | } |
| @@ -429,7 +477,7 @@ static void at91sam9_sdram_standby(void) · 23 unmodified lines |
| 429 | 477 | u32 lpr0, lpr1 = 0; |
| 430 | 478 | u32 saved_lpr0, saved_lpr1 = 0; |
| 431 | 479 | |
| 432 | | − if (pm_data.ramc[1]) { |
| 480 | + if (soc_pm.data.ramc[1]) { |
| 433 | 481 | saved_lpr1 = at91_ramc_read(1, AT91_SDRAMC_LPR); |
| 434 | 482 | lpr1 = saved_lpr1 & ~AT91_SDRAMC_LPCB; |
| 435 | 483 | lpr1 |= AT91_SDRAMC_LPCB_SELF_REFRESH; |
| @@ -441,13 +489,13 @@ static void at91sam9_sdram_standby(void) · 5 unmodified lines |
| 441 | 489 | |
| 442 | 490 | /* self-refresh mode now */ |
| 443 | 491 | at91_ramc_write(0, AT91_SDRAMC_LPR, lpr0); |
| 444 | | − if (pm_data.ramc[1]) |
| 492 | + if (soc_pm.data.ramc[1]) |
| 445 | 493 | at91_ramc_write(1, AT91_SDRAMC_LPR, lpr1); |
| 446 | 494 | |
| 447 | 495 | cpu_do_idle(); |
| 448 | 496 | |
| 449 | 497 | at91_ramc_write(0, AT91_SDRAMC_LPR, saved_lpr0); |
| 450 | | − if (pm_data.ramc[1]) |
| 498 | + if (soc_pm.data.ramc[1]) |
| 451 | 499 | at91_ramc_write(1, AT91_SDRAMC_LPR, saved_lpr1); |
| 452 | 500 | } |
| 453 | 501 | |
| @@ -480,14 +528,14 @@ static __init void at91_dt_ramc(void) · 26 unmodified lines |
| 480 | 528 | const struct ramc_info *ramc; |
| 481 | 529 | |
| 482 | 530 | for_each_matching_node_and_match(np, ramc_ids, &of_id) { |
| 483 | | − pm_data.ramc[idx] = of_iomap(np, 0); |
| 484 | | − if (!pm_data.ramc[idx]) |
| 531 | + soc_pm.data.ramc[idx] = of_iomap(np, 0); |
| 532 | + if (!soc_pm.data.ramc[idx]) |
| 485 | 533 | panic(pr_fmt("unable to map ramc[%d] cpu registers\n"), idx); |
| 486 | 534 | |
| 487 | 535 | ramc = of_id->data; |
| 488 | 536 | if (!standby) |
| 489 | 537 | standby = ramc->idle; |
| 490 | | − pm_data.memctrl = ramc->memctrl; |
| 538 | + soc_pm.data.memctrl = ramc->memctrl; |
| 491 | 539 | |
| 492 | 540 | idx++; |
| 493 | 541 | } |
| @@ -509,12 +557,17 @@ static void at91rm9200_idle(void) · 15 unmodified lines |
| 509 | 557 | * Disable the processor clock. The processor will be automatically |
| 510 | 558 | * re-enabled by an interrupt or by a reset. |
| 511 | 559 | */ |
| 512 | | − writel(AT91_PMC_PCK, pm_data.pmc + AT91_PMC_SCDR); |
| 560 | + writel(AT91_PMC_PCK, soc_pm.data.pmc + AT91_PMC_SCDR); |
| 561 | +} |
| 562 | + |
| 563 | +static void at91sam9x60_idle(void) |
| 564 | +{ |
| 565 | + cpu_do_idle(); |
| 513 | 566 | } |
| 514 | 567 | |
| 515 | 568 | static void at91sam9_idle(void) |
| 516 | 569 | { |
| 517 | | − writel(AT91_PMC_PCK, pm_data.pmc + AT91_PMC_SCDR); |
| 570 | + writel(AT91_PMC_PCK, soc_pm.data.pmc + AT91_PMC_SCDR); |
| 518 | 571 | cpu_do_idle(); |
| 519 | 572 | } |
| 520 | 573 | |
| @@ -566,8 +619,8 @@ static void __init at91_pm_sram_init(void) · 45 unmodified lines |
| 566 | 619 | |
| 567 | 620 | static bool __init at91_is_pm_mode_active(int pm_mode) |
| 568 | 621 | { |
| 569 | | − return (pm_data.standby_mode == pm_mode || |
| 570 | | − pm_data.suspend_mode == pm_mode); |
| 622 | + return (soc_pm.data.standby_mode == pm_mode || |
| 623 | + soc_pm.data.suspend_mode == pm_mode); |
| 571 | 624 | } |
| 572 | 625 | |
| 573 | 626 | static int __init at91_pm_backup_init(void) |
| @@ -577,6 +630,9 @@ static int __init at91_pm_backup_init(void) · 3 unmodified lines |
| 577 | 630 | struct platform_device *pdev = NULL; |
| 578 | 631 | int ret = -ENODEV; |
| 579 | 632 | |
| 633 | + if (!IS_ENABLED(CONFIG_SOC_SAMA5D2)) |
| 634 | + return -EPERM; |
| 635 | + |
| 580 | 636 | if (!at91_is_pm_mode_active(AT91_PM_BACKUP)) |
| 581 | 637 | return 0; |
| 582 | 638 | |
| @@ -586,7 +642,7 @@ static int __init at91_pm_backup_init(void) · 3 unmodified lines |
| 586 | 642 | return ret; |
| 587 | 643 | } |
| 588 | 644 | |
| 589 | | − pm_data.sfrbu = of_iomap(np, 0); |
| 645 | + soc_pm.data.sfrbu = of_iomap(np, 0); |
| 590 | 646 | of_node_put(np); |
| 591 | 647 | |
| 592 | 648 | np = of_find_compatible_node(NULL, NULL, "atmel,sama5d2-securam"); |
| @@ -622,8 +678,8 @@ static int __init at91_pm_backup_init(void) · 29 unmodified lines |
| 622 | 678 | securam_fail: |
| 623 | 679 | put_device(&pdev->dev); |
| 624 | 680 | securam_fail_no_ref_dev: |
| 625 | | − iounmap(pm_data.sfrbu); |
| 626 | | − pm_data.sfrbu = NULL; |
| 681 | + iounmap(soc_pm.data.sfrbu); |
| 682 | + soc_pm.data.sfrbu = NULL; |
| 627 | 683 | return ret; |
| 628 | 684 | } |
| 629 | 685 | |
| @@ -632,10 +688,10 @@ static void __init at91_pm_use_default_mode(int pm_mode) · 2 unmodified lines |
| 632 | 688 | if (pm_mode != AT91_PM_ULP1 && pm_mode != AT91_PM_BACKUP) |
| 633 | 689 | return; |
| 634 | 690 | |
| 635 | | − if (pm_data.standby_mode == pm_mode) |
| 636 | | − pm_data.standby_mode = AT91_PM_ULP0; |
| 637 | | − if (pm_data.suspend_mode == pm_mode) |
| 638 | | − pm_data.suspend_mode = AT91_PM_ULP0; |
| 691 | + if (soc_pm.data.standby_mode == pm_mode) |
| 692 | + soc_pm.data.standby_mode = AT91_PM_ULP0; |
| 693 | + if (soc_pm.data.suspend_mode == pm_mode) |
| 694 | + soc_pm.data.suspend_mode = AT91_PM_ULP0; |
| 639 | 695 | } |
| 640 | 696 | |
| 641 | 697 | static void __init at91_pm_modes_init(void) |
| @@ -653,7 +709,7 @@ static void __init at91_pm_modes_init(void) · 11 unmodified lines |
| 653 | 709 | goto ulp1_default; |
| 654 | 710 | } |
| 655 | 711 | |
| 656 | | − pm_data.shdwc = of_iomap(np, 0); |
| 712 | + soc_pm.data.shdwc = of_iomap(np, 0); |
| 657 | 713 | of_node_put(np); |
| 658 | 714 | |
| 659 | 715 | ret = at91_pm_backup_init(); |
| @@ -667,8 +723,8 @@ static void __init at91_pm_modes_init(void) · 7 unmodified lines |
| 667 | 723 | return; |
| 668 | 724 | |
| 669 | 725 | unmap: |
| 670 | | − iounmap(pm_data.shdwc); |
| 671 | | − pm_data.shdwc = NULL; |
| 726 | + iounmap(soc_pm.data.shdwc); |
| 727 | + soc_pm.data.shdwc = NULL; |
| 672 | 728 | ulp1_default: |
| 673 | 729 | at91_pm_use_default_mode(AT91_PM_ULP1); |
| 674 | 730 | backup_default: |
| @@ -711,14 +767,14 @@ static void __init at91_pm_init(void (*pm_idle)(void)) · 36 unmodified lines |
| 711 | 767 | platform_device_register(&at91_cpuidle_device); |
| 712 | 768 | |
| 713 | 769 | pmc_np = of_find_matching_node_and_match(NULL, atmel_pmc_ids, &of_id); |
| 714 | | − pm_data.pmc = of_iomap(pmc_np, 0); |
| 715 | | − if (!pm_data.pmc) { |
| 770 | + soc_pm.data.pmc = of_iomap(pmc_np, 0); |
| 771 | + if (!soc_pm.data.pmc) { |
| 716 | 772 | pr_err("AT91: PM not supported, PMC not found\n"); |
| 717 | 773 | return; |
| 718 | 774 | } |
| 719 | 775 | |
| 720 | 776 | pmc = of_id->data; |
| 721 | | − pm_data.uhp_udp_mask = pmc->uhp_udp_mask; |
| 777 | + soc_pm.data.uhp_udp_mask = pmc->uhp_udp_mask; |
| 722 | 778 | |
| 723 | 779 | if (pm_idle) |
| 724 | 780 | arm_pm_idle = pm_idle; |
| @@ -728,8 +784,8 @@ static void __init at91_pm_init(void (*pm_idle)(void)) · 3 unmodified lines |
| 728 | 784 | if (at91_suspend_sram_fn) { |
| 729 | 785 | suspend_set_ops(&at91_pm_ops); |
| 730 | 786 | pr_info("AT91: PM: standby: %s, suspend: %s\n", |
| 731 | | − pm_modes[pm_data.standby_mode].pattern, |
| 732 | | − pm_modes[pm_data.suspend_mode].pattern); |
| 787 | + pm_modes[soc_pm.data.standby_mode].pattern, |
| 788 | + pm_modes[soc_pm.data.suspend_mode].pattern); |
| 733 | 789 | } else { |
| 734 | 790 | pr_info("AT91: PM not supported, due to no SRAM allocated\n"); |
| 735 | 791 | } |
| @@ -750,6 +806,19 @@ void __init at91rm9200_pm_init(void) · 14 unmodified lines |
| 750 | 806 | at91_pm_init(at91rm9200_idle); |
| 751 | 807 | } |
| 752 | 808 | |
| 809 | +void __init sam9x60_pm_init(void) |
| 810 | +{ |
| 811 | + if (!IS_ENABLED(CONFIG_SOC_AT91SAM9)) |
| 812 | + return; |
| 813 | + |
| 814 | + at91_pm_modes_init(); |
| 815 | + at91_dt_ramc(); |
| 816 | + at91_pm_init(at91sam9x60_idle); |
| 817 | + |
| 818 | + soc_pm.ws_ids = sam9x60_ws_ids; |
| 819 | + soc_pm.config_pmc_ws = at91_sam9x60_config_pmc_ws; |
| 820 | +} |
| 821 | + |
| 753 | 822 | void __init at91sam9_pm_init(void) |
| 754 | 823 | { |
| 755 | 824 | if (!IS_ENABLED(CONFIG_SOC_AT91SAM9)) |
| @@ -775,6 +844,10 @@ void __init sama5d2_pm_init(void) · 19 unmodified lines |
| 775 | 844 | |
| 776 | 845 | at91_pm_modes_init(); |
| 777 | 846 | sama5_pm_init(); |
| 847 | + |
| 848 | + soc_pm.ws_ids = sama5d2_ws_ids; |
| 849 | + soc_pm.config_shdwc_ws = at91_sama5d2_config_shdwc_ws; |
| 850 | + soc_pm.config_pmc_ws = at91_sama5d2_config_pmc_ws; |
| 778 | 851 | } |
| 779 | 852 | |
| 780 | 853 | static int __init at91_pm_modes_select(char *str) |
| @@ -795,8 +868,8 @@ static int __init at91_pm_modes_select(char *str) · 14 unmodified lines |
| 795 | 868 | if (suspend < 0) |
| 796 | 869 | return 0; |
| 797 | 870 | |
| 798 | | − pm_data.standby_mode = standby; |
| 799 | | − pm_data.suspend_mode = suspend; |
| 871 | + soc_pm.data.standby_mode = standby; |
| 872 | + soc_pm.data.suspend_mode = suspend; |
| 800 | 873 | |
| 801 | 874 | return 0; |
| 802 | 875 | } |